Ejemplo n.º 1
0
Archivo: window.c Proyecto: rck/sxiv
void win_set_sizehints(win_t *win) {
	XSizeHints sizehints;

	if (!win || !win->xwin)
		return;

	sizehints.flags = PMinSize | PMaxSize;
	sizehints.min_width = win->w;
	sizehints.max_width = win->w;
	sizehints.min_height = win->h;
	sizehints.max_height = win->h;
	XSetWMNormalHints(win->env.dpy, win->xwin, &sizehints);
}
Ejemplo n.º 2
0
void OsWindow::set_resizable(bool resizable)
{
	XSizeHints hints;
	hints.flags = PMinSize | PMaxSize;
	hints.min_width = resizable ? 1 : m_width;
	hints.min_height = resizable ? 1 : m_height;
	hints.max_width = resizable ? 65535 : m_width;
	hints.max_height = resizable ? 65535 : m_height;

	XSetWMNormalHints(m_x11_display, m_x11_window, &hints);

	m_resizable = resizable;
}
Ejemplo n.º 3
0
Archivo: panel.c Proyecto: o9000/tint2
void set_panel_window_geometry(Panel *panel)
{
	update_strut(panel);

	// Fixed position and non-resizable window
	// Allow panel move and resize when tint2 reload config file
	int minwidth = panel_autohide ? panel->hidden_width : panel->area.width;
	int minheight = panel_autohide ? panel->hidden_height : panel->area.height;
	XSizeHints size_hints;
	size_hints.flags = PPosition | PMinSize | PMaxSize;
	size_hints.min_width = minwidth;
	size_hints.max_width = panel->area.width;
	size_hints.min_height = minheight;
	size_hints.max_height = panel->area.height;
	XSetWMNormalHints(server.display, panel->main_win, &size_hints);

	if (!panel->is_hidden) {
		if (panel_horizontal) {
			XMoveResizeWindow(server.display,
			                  panel->main_win,
			                  panel->posx,
			                  panel->posy,
			                  panel->area.width,
			                  panel->area.height);
		} else {
			XMoveResizeWindow(server.display,
			                  panel->main_win,
			                  panel->posx,
			                  panel->posy,
			                  panel->area.width,
			                  panel->area.height);
		}
	} else {
		int diff = (panel_horizontal ? panel->area.height : panel->area.width) - panel_autohide_height;
		if (panel_horizontal) {
			XMoveResizeWindow(server.display,
			                  panel->main_win,
			                  panel->posx,
			                  panel->posy + diff,
			                  panel->hidden_width,
			                  panel->hidden_height);
		} else {
			XMoveResizeWindow(server.display,
			                  panel->main_win,
			                  panel->posx + diff,
			                  panel->posy,
			                  panel->hidden_width,
			                  panel->hidden_height);
		}
	}
}
Ejemplo n.º 4
0
void gTrayIcon::setVisible(bool vl)
{
	if (vl)
	{
		if (!plug)
		{
			_loopLevel = gApplication::loopLevel() + 1;
			
			plug = gtk_status_icon_new();

			updatePicture();
			updateTooltip();

			#ifdef GDK_WINDOWING_X11
			// Needed, otherwise the icon does not appear in Gnome or XFCE notification area!
			XSizeHints hints;
			hints.flags = PMinSize;
			hints.min_width = _iconw;
			hints.min_height = _iconh;
			XSetWMNormalHints(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gtk_status_icon_get_x11_window_id(plug), &hints);
			#endif

			gtk_status_icon_set_visible(plug, TRUE);

			//g_signal_connect(G_OBJECT(plug), "destroy", G_CALLBACK(cb_destroy),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-press-event", G_CALLBACK(cb_button_press), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-release-event", G_CALLBACK(cb_button_release),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug), "activate", G_CALLBACK(cb_activate),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-in-event",G_CALLBACK(tray_focus_In),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-out-event",G_CALLBACK(tray_focus_Out),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"enter-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"leave-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "popup-menu", G_CALLBACK(cb_menu), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "scroll-event", G_CALLBACK(cb_scroll), (gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"expose-event", G_CALLBACK(cb_expose), (gpointer)this);
			
			_visible_count++;

			usleep(10000); // BUG: Embedding too fast sometimes fails with GTK+
		}
	}
	else
	{
		if (plug)
		{
			GB.Post((void (*)())hide_icon, (intptr_t)plug);
			plug = NULL;
			_visible_count--;
		}
	}
}
Ejemplo n.º 5
0
void
resizeWindow(Window window, int w, int h)
{
    // Tell the window manager to respect the requested size
    XSizeHints size_hints;
    size_hints.max_width  = size_hints.min_width  = w;
    size_hints.max_height = size_hints.min_height = h;
    size_hints.flags = PMinSize | PMaxSize;
    XSetWMNormalHints(display, window, &size_hints);

    XResizeWindow(display, window, w, h);

    waitForEvent(window, ConfigureNotify);
}
Ejemplo n.º 6
0
void
match_size_hints(Window xterm, int add_y)
{
	XSizeHints * size_hints = XAllocSizeHints();
	long returned = 0;
	XGetWMNormalHints(gdi.display, xterm, size_hints, &returned);
	size_hints->base_height += add_y;
	size_hints->max_height += add_y;
	size_hints->min_height += add_y;
	size_hints->width_inc = 1;
	size_hints->height_inc = 1;
	XSetWMNormalHints(gdi.display, gdi.mainw, size_hints);
	XFree(size_hints);
}
Ejemplo n.º 7
0
    void
    resize(int w, int h) {
        if (w == width && h == height) {
            return;
        }

        eglWaitClient();

        // We need to ensure that pending events are processed here, and XSync
        // with discard = True guarantees that, but it appears the limited
        // event processing we do so far is sufficient
        //XSync(display, True);

        Drawable::resize(w, h);

        XResizeWindow(display, window, w, h);

        // Tell the window manager to respect the requested size
        XSizeHints size_hints;
        size_hints.max_width  = size_hints.min_width  = w;
        size_hints.max_height = size_hints.min_height = h;
        size_hints.flags = PMinSize | PMaxSize;
        XSetWMNormalHints(display, window, &size_hints);

        waitForEvent(ConfigureNotify);

        eglWaitNative(EGL_CORE_NATIVE_ENGINE);

        /*
         * Some implementations won't update the backbuffer unless we recreate
         * the EGL surface.
         */

        int eglWidth;
        int eglHeight;

        eglQuerySurface(eglDisplay, surface, EGL_WIDTH, &eglWidth);
        eglQuerySurface(eglDisplay, surface, EGL_HEIGHT, &eglHeight);

        if (eglWidth != width || eglHeight != height) {
            recreate();

            eglQuerySurface(eglDisplay, surface, EGL_WIDTH, &eglWidth);
            eglQuerySurface(eglDisplay, surface, EGL_HEIGHT, &eglHeight);
        }

        assert(eglWidth == width);
        assert(eglHeight == height);
    }
Ejemplo n.º 8
0
/**
 * @brief Replace the size hints for the WM_NORMAL_HINTS property of a window.
 *
 * @param win pointer to a ws window structure
 */
static void wsWindowSizeHint(wsWindow *win)
{
    XSizeHints size;

    size.flags = 0;

    /* obsolete, solely for compatibility reasons */
    size.flags |= PPosition;
    size.x      = win->X;
    size.y      = win->Y;

    /* obsolete, solely for compatibility reasons */
    size.flags |= PSize;
    size.width  = win->Width;
    size.height = win->Height;

    /* a minimum of 4 is said to avoid off-by-one errors and be required by mga_vid */
    size.flags     |= PMinSize;
    size.min_width  = 4;
    size.min_height = 4;

    if (win->Property & wsMinSize) {
        size.min_width  = win->Width;
        size.min_height = win->Height;
    }

    if (win->Property & wsMaxSize) {
        size.flags     |= PMaxSize;
        size.max_width  = win->Width;
        size.max_height = win->Height;
    }

    if (vo_keepaspect && (win->Property & wsAspect)) {
        size.flags |= PAspect;
        size.min_aspect.x = win->Width;
        size.min_aspect.y = win->Height;
        size.max_aspect.x = win->Width;
        size.max_aspect.y = win->Height;
    }

    size.flags      |= PBaseSize;
    size.base_width  = 0;
    size.base_height = 0;

    size.flags      |= PWinGravity;
    size.win_gravity = StaticGravity;

    XSetWMNormalHints(wsDisplay, win->WindowID, &size);
}
Ejemplo n.º 9
0
void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height)
{
	XSizeHints* size_hints;

	size_hints = XAllocSizeHints();

	if (size_hints)
	{
		size_hints->flags = PMinSize | PMaxSize;
		size_hints->min_width = size_hints->max_width = xfi->width;
		size_hints->min_height = size_hints->max_height = xfi->height;
		XSetWMNormalHints(xfi->display, window->handle, size_hints);
		XFree(size_hints);
	}
}
Ejemplo n.º 10
0
void Gflushlazyq (void) {
    if (Glazyq.flag & LAZYMANAGE) {
        XtManageChildren (Glazyq.mws, Glazyq.mwn);
        Glazyq.flag &= ~LAZYMANAGE;
    }
    if (Glazyq.flag & LAZYREALIZE) {
        XtRealizeWidget (Glazyq.rw);
        if (Glazyq.flag & LAZYRHINTS)
            XSetWMNormalHints (Gdisplay, XtWindow (Glazyq.rw), &Glazyq.hints);
        XSetWMProtocols (Gdisplay, XtWindow (Glazyq.rw), &Gwmdelatom, 1);
        XtOverrideTranslations (Glazyq.rw, Gwmdeltable);
        Glazyq.flag &= ~LAZYRHINTS;
        Glazyq.flag &= ~LAZYREALIZE;
    }
}
Ejemplo n.º 11
0
int	mlx_int_anti_resize_win(t_xvar *xvar,Window win,int w,int h)
{
  XSizeHints    hints;
  long		toto;
  
  XGetWMNormalHints(xvar->display,win,&hints,&toto);
  hints.width = w;
  hints.height = h;
  hints.min_width = w;
  hints.min_height = h;
  hints.max_width = w;
  hints.max_height = h;
  hints.flags = PPosition | PSize | PMinSize | PMaxSize;
  XSetWMNormalHints(xvar->display,win,&hints);
}
Ejemplo n.º 12
0
void OS_X11::set_window_resizable(bool p_enabled) {
	XSizeHints *xsh;
	xsh = XAllocSizeHints();
	xsh->flags = p_enabled ? 0L : PMinSize | PMaxSize;
	if(!p_enabled) {
		XWindowAttributes xwa;
		XGetWindowAttributes(x11_display,x11_window,&xwa);
		xsh->min_width = xwa.width;
		xsh->max_width = xwa.width;
		xsh->min_height = xwa.height;
		xsh->max_height = xwa.height;
	}
	XSetWMNormalHints(x11_display, x11_window, xsh);
	XFree(xsh);
	current_videomode.resizable = p_enabled;
}
Ejemplo n.º 13
0
void 
setSizeHint(Display* display, Window window, 
	    int minWidth, int minHeight, 
	    int maxWidth, int maxHeight) 
{
  XSizeHints hints = {};
  if(minWidth > 0 && minHeight > 0) hints.flags |= PMinSize;
  if(maxWidth > 0 && maxHeight > 0) hints.flags |= PMaxSize;

  hints.min_width = minWidth;
  hints.min_height = minHeight;
  hints.max_width = maxWidth;
  hints.max_height = maxHeight;

  XSetWMNormalHints(display, window, &hints);
}
Ejemplo n.º 14
0
void Glazyrealize (Widget w, int hintsflag, XSizeHints *hintsp) {
    if (Glazyq.flag & LAZYREALIZE) {
        XtRealizeWidget (Glazyq.rw);
        if (Glazyq.flag & LAZYRHINTS)
            XSetWMNormalHints (Gdisplay, XtWindow (Glazyq.rw), &Glazyq.hints);
        XSetWMProtocols (Gdisplay, XtWindow (Glazyq.rw), &Gwmdelatom, 1);
        XtOverrideTranslations (Glazyq.rw, Gwmdeltable);
    } else
        Glazyq.flag |= LAZYREALIZE;
    Glazyq.rw = w;
    if (hintsflag) {
        Glazyq.flag |= LAZYRHINTS;
        Glazyq.hints = *hintsp;
    } else
        Glazyq.flag &= ~LAZYRHINTS;
}
Ejemplo n.º 15
0
void _al_xwin_reset_size_hints(ALLEGRO_DISPLAY *d)
{
   ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver();
   ALLEGRO_DISPLAY_XGLX *glx = (void *)d;
   XSizeHints *hints = XAllocSizeHints();

   hints->flags = PMinSize | PMaxSize;
   hints->min_width  = 0;
   hints->min_height = 0;
   // FIXME: Is there a way to remove/reset max dimensions?
   hints->max_width  = 32768;
   hints->max_height = 32768;
   XSetWMNormalHints(system->x11display, glx->window, hints);

   XFree(hints);
}
Ejemplo n.º 16
0
void
XSetWMProperties(Display * display, Window w, XTextProperty * window_name,
	XTextProperty * icon_name, char **argv, int argc,
	XSizeHints * normal_hints, XWMHints * wm_hints, XClassHint *class_hints)
{
	if (window_name)
		XSetWMName(display, w, window_name);
	if (icon_name)
		XSetWMIconName(display, w, icon_name);
	if (normal_hints)
		XSetWMNormalHints(display, w, normal_hints);
	if (wm_hints)
		XSetWMHints(display, w, wm_hints);
	if (class_hints)
		XSetWMClassHints(display, w, class_hints);
}
Ejemplo n.º 17
0
static void child_win_init(void)
{
	XSetWindowAttributes attr;
	XGCValues gcv;
	XColor color, dummy;
	XSizeHints sizehints;
	
	/*
	 * start graphical output
	 */
	if (!(display = XOpenDisplay(NULL))) {
		fprintf(stderr, "X: Unable to open X display\n");
		exit(1);
	}
	XSetErrorHandler(x_error_handler);
        XAllocNamedColor(display, DefaultColormap(display, 0), "red",
                         &color, &dummy);
        col_zeroline = color.pixel;
        col_background = WhitePixel(display, 0);
        col_trace = BlackPixel(display, 0);
        attr.background_pixel = col_background;
	window = XCreateWindow(display, XRootWindow(display, 0),
			       200, 200, WIDTH, HEIGHT, 5, 
			       DefaultDepth(display, 0),
			       InputOutput, DefaultVisual(display, 0),
			       CWBackPixel, &attr);
        if (!(pixmap = XCreatePixmap(display, window, WIDTH, HEIGHT,
                                     DefaultDepth(display, 0)))) {
                fprintf(stderr, "X: unable to open offscreen pixmap\n");
                exit(1);
        }
        XSelectInput(display, window, KeyPressMask | StructureNotifyMask
                     | ExposureMask) ;
	gcv.line_width = 1;
	gcv.line_style = LineSolid;
	gc = XCreateGC(display, pixmap, GCForeground | GCLineWidth, &gcv);
	/*
	 * Do not allow the window to be resized
	 */
	memset(&sizehints, 0, sizeof(sizehints));
	sizehints.min_width = sizehints.max_width = WIDTH;
	sizehints.min_height = sizehints.max_height = HEIGHT;
	sizehints.flags = PMinSize | PMaxSize;
	XSetWMNormalHints(display, window, &sizehints);
	XMapWindow(display, window);
	XSynchronize(display, 1);
}	
void
set_dialog_properties (Display *d, Window w, char *name, int width, int height)
{
  XTextProperty nameprop;
  if (!XStringListToTextProperty (&name, 1, &nameprop)) {
    warn ("XStringListToTextProperty failed\n");
    return;
  }
  XSetWMName (d, w, &nameprop);

  XSizeHints *sh = XAllocSizeHints ();
  sh->base_width = sh->min_width = sh->max_width = width;
  sh->base_height = sh->min_height = sh->max_height = height;
  sh->flags = PBaseSize | PMinSize | PMaxSize;
  XSetWMNormalHints (d, w, sh);
  XFree (sh);
}
Ejemplo n.º 19
0
// ----------------------------------------------------------------------------------------------
//    Move window to x, y.
// ----------------------------------------------------------------------------------------------
void wsMoveWindow(wsTWindow *win, int b, int x, int y)
{
    if (b) {
        switch (x) {
        case -1:
            win->X = (wsMaxX / 2) - (win->Width / 2) + wsOrgX;
            break;

        case -2:
            win->X = wsMaxX - win->Width + wsOrgX;
            break;

        default:
            win->X = x;
            break;
        }

        switch (y) {
        case -1:
            win->Y = (wsMaxY / 2) - (win->Height / 2) + wsOrgY;
            break;

        case -2:
            win->Y = wsMaxY - win->Height + wsOrgY;
            break;

        default:
            win->Y = y;
            break;
        }
    } else {
        win->X = x;
        win->Y = y;
    }

    win->SizeHint.flags       = PPosition | PWinGravity;
    win->SizeHint.x           = win->X;
    win->SizeHint.y           = win->Y;
    win->SizeHint.win_gravity = StaticGravity;
    XSetWMNormalHints(wsDisplay, win->WindowID, &win->SizeHint);

    XMoveWindow(wsDisplay, win->WindowID, win->X, win->Y);

    if (win->ReSize)
        win->ReSize(win->X, win->Y, win->Width, win->Height);
}
Ejemplo n.º 20
0
	void X11Window::set_maximum_size(int width, int height, bool size_is_client_area)
	{
		maximum_size = Size(width,height);

		if (!size_is_client_area)
		{
			maximum_size.width -= frame_extents.left + frame_extents.right;
			maximum_size.height -= frame_extents.top + frame_extents.bottom;
		}

		long user_hints;
		XGetWMNormalHints(handle.display, handle.window, size_hints, &user_hints);
		size_hints->max_width   = maximum_size.width;
		size_hints->max_height  = maximum_size.height;
		size_hints->flags |= PMaxSize;
		XSetWMNormalHints(handle.display, handle.window, size_hints);
	}
Ejemplo n.º 21
0
void QXlibWindow::doSizeHints()
{
    Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created));
    XSizeHints s;
    s.flags = 0;
    QRect g = geometry();
    s.x = g.x();
    s.y = g.y();
    s.width = g.width();
    s.height = g.height();
    s.flags |= USPosition;
    s.flags |= PPosition;
    s.flags |= USSize;
    s.flags |= PSize;
    s.flags |= PWinGravity;
    s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity;
    XSetWMNormalHints(mScreen->display()->nativeDisplay(), x_window, &s);
}
Ejemplo n.º 22
0
void PropagateSizeHints(QWidget *w)
{
    const auto display = QX11Info::display();
    XSizeHints *sh = XAllocSizeHints();
    sh->flags = PPosition | PSize | PMinSize | PMaxSize | PResizeInc;
    sh->x = w->x();
    sh->y = w->y();
    sh->min_width = w->minimumWidth();
    sh->min_height = w->minimumHeight();
    sh->base_width = w->baseSize().width();
    sh->base_height = w->baseSize().height();
    sh->max_width = w->maximumWidth();
    sh->max_height = w->maximumHeight();
    sh->width_inc =  w->sizeIncrement().width();
    sh->height_inc = w->sizeIncrement().height();
    XSetWMNormalHints(display, w->winId(), sh);
    XFree(sh);
}
Ejemplo n.º 23
0
void
x_window_rep::set_size_limits (SI min_w, SI min_h, SI max_w, SI max_h) {
  if (min_w == Min_w && min_h == Min_h && max_w == Max_w && max_h == Max_h)
    return;
  Min_w= min_w; Min_h= min_h; Max_w= max_w; Max_h= max_h;
  min_w= min_w/PIXEL; min_h= min_h/PIXEL;
  max_w= max_w/PIXEL; max_h= max_h/PIXEL;

  XSizeHints* size_hints;
  ASSERT (size_hints= XAllocSizeHints (), "out of memory (X server)");
  size_hints->flags       = PMinSize | PMaxSize;
  size_hints->min_width   = min_w;
  size_hints->min_height  = min_h;
  size_hints->max_width   = max_w;
  size_hints->max_height  = max_h;
  XSetWMNormalHints (dpy, win, size_hints);
  XFree(size_hints);
}
Ejemplo n.º 24
0
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{
    int mode = 0, rate, sizeChanged = GL_FALSE;
    XSizeHints* sizehints;

    rate = window->refreshRate;

    if (window->mode == GLFW_FULLSCREEN)
    {
        // Get the closest matching video mode for the specified window size
        mode = _glfwGetClosestVideoMode(&width, &height, &rate);
    }

    if (!window->resizable)
    {
        // Update window size restrictions to match new window size

        sizehints = XAllocSizeHints();
        sizehints->flags = 0;

        sizehints->min_width  = sizehints->max_width  = width;
        sizehints->min_height = sizehints->max_height = height;

        XSetWMNormalHints(_glfwLibrary.X11.display, window->X11.handle, sizehints);
        XFree(sizehints);
    }

    // Change window size before changing fullscreen mode?
    if (window->mode == GLFW_FULLSCREEN && (width > window->width))
    {
        XResizeWindow(_glfwLibrary.X11.display, window->X11.handle, width, height);
        sizeChanged = GL_TRUE;
    }

    if (window->mode == GLFW_FULLSCREEN)
    {
        // Change video mode, keeping current refresh rate
        _glfwSetVideoModeMODE(mode, window->refreshRate);
    }

    // Set window size (if not already changed)
    if (!sizeChanged)
        XResizeWindow(_glfwLibrary.X11.display, window->X11.handle, width, height);
}
Ejemplo n.º 25
0
bool XPlatformWindow::tell_platform_size_hints() {
  if ( _min_w == -1)
    return true; // hack for don't care
    
  // tell window manager that we'd like our own size and position
  XSizeHints* size_hints;
  if ((size_hints = XAllocSizeHints()) == NULL) {
    warning("X structure allocation for size hints failed--spy won't work.");
    close();
    return false;
  }
  size_hints->flags = PPosition | PSize | PMinSize | PMaxSize;
  size_hints->min_width  = _min_w;
  size_hints->max_width  = _max_w;
  size_hints->min_height = _min_h;
  size_hints->max_height = _max_h;
  XSetWMNormalHints(_display, _xwindow, size_hints);
  return true;
}
Ejemplo n.º 26
0
Archivo: window.c Proyecto: hirkmt/sxiv
void win_update_sizehints(win_t *win)
{
	if (win == NULL || win->xwin == None)
		return;

	if ((win->sizehints.flags & USSize) != 0) {
		win->sizehints.width  = win->w;
		win->sizehints.height = win->h + win->bar.h;
	}
	if ((win->sizehints.flags & USPosition) != 0) {
		win->sizehints.x = win->x;
		win->sizehints.y = win->y;
	}
	if (options->fixed_win) {
		win->sizehints.min_width  = win->sizehints.max_width  = win->w;
		win->sizehints.min_height = win->sizehints.max_height = win->h + win->bar.h;
	}
	XSetWMNormalHints(win->env.dpy, win->xwin, &win->sizehints);
}
Ejemplo n.º 27
0
// ----------------------------------------------------------------------------------------------
//    Move window to x, y.
// ----------------------------------------------------------------------------------------------
void wsMoveWindow(wsTWindow *win, Bool abs, int x, int y)
{
    if (abs) {
        win->X = x;
        win->Y = y;
    } else
        wsWindowPosition(win, x, y, win->Width, win->Height);

    win->SizeHint.flags       = PPosition | PWinGravity;
    win->SizeHint.x           = win->X;
    win->SizeHint.y           = win->Y;
    win->SizeHint.win_gravity = StaticGravity;
    XSetWMNormalHints(wsDisplay, win->WindowID, &win->SizeHint);

    XMoveWindow(wsDisplay, win->WindowID, win->X, win->Y);

    if (win->ReSize)
        win->ReSize(win->X, win->Y, win->Width, win->Height);
}
Ejemplo n.º 28
0
void X11Window::_impl_setSize(int32 width, int32 height)
{
    if (m_Desc.resizable)
    {
       // Update window size restrictions to match new window size

       XSizeHints* hints = XAllocSizeHints();

       hints->flags |= (PMinSize | PMaxSize);
       hints->min_width  = hints->max_width  = width;
       hints->min_height = hints->max_height = height;

       XSetWMNormalHints(m_Display, m_Window, hints);
       XFree(hints);
    }

    XResizeWindow(m_Display, m_Window, width, height);
    XFlush(m_Display);
}
Ejemplo n.º 29
0
void TopWindow::SyncSizeHints()
{
	GuiLock __; 
	Size min = GetMinSize();
	Size max = GetMaxSize();
	if(!sizeable)
		min = max = GetRect().Size();
	Window w = GetWindow();
	if(w && (min != xminsize || max != xmaxsize) && !frameless) {
		xminsize = min;
		xmaxsize = max;
		size_hints->min_width = min.cx;
		size_hints->min_height = min.cy;
		size_hints->max_width = max.cx;
		size_hints->max_height = max.cy;
		size_hints->flags = PMinSize|PMaxSize;
		XSetWMNormalHints(Xdisplay, w, size_hints);
	}
}
Ejemplo n.º 30
0
void TextEdit::createWindow()
{
    if (GWindow::m_Display == 0)
    {  if (!GWindow::initX()) { perror("A connection with X server could not be established"); exit(1); } }

    // Load font, calculate window size, etc.
    initialize();

    strncpy(m_WindowTitle, getFileName(), 127);
    setBgColorName("LightGray");
    setFgColorName("black");

    GWindow::createWindow();

    // Save background and foreground colors
    bgColor = getBackground();
    fgColor = getForeground();

    // Status line colors               /usr/X11R6/lib/X11/rgb.txt
    bgStatusLineColor = allocateColor("MidnightBlue");
    fgStatusLineColor = allocateColor("white");

    setFont(textFont);

    // Hints for window manager
    XSizeHints sizeHints;
    memset(&sizeHints, 0, sizeof(sizeHints));

    // Minimal size 16 * 1
    sizeHints.min_width = 44*dx + leftMargin + rightMargin;
    sizeHints.min_height = 1*dy + topMargin + bottomMargin;

    // Base size
    sizeHints.base_width = 0*dx + leftMargin + rightMargin;
    sizeHints.base_height = 0*dy + topMargin + bottomMargin;

    // Resize increment
    sizeHints.width_inc = dx;
    sizeHints.height_inc = dy;

    sizeHints.flags = (PMinSize | PBaseSize | PResizeInc);
    XSetWMNormalHints(m_Display, m_Window, &sizeHints);
}