void meta_compositor_sync_screen_size (MetaCompositor *compositor, MetaScreen *screen, guint width, guint height) { MetaDisplay *display = meta_screen_get_display (screen); MetaCompScreen *info = meta_screen_get_compositor_data (screen); Display *xdisplay; Window xwin; DEBUG_TRACE ("meta_compositor_sync_screen_size\n"); g_return_if_fail (info); xdisplay = meta_display_get_xdisplay (display); xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage)); XResizeWindow (xdisplay, xwin, width, height); meta_background_actor_screen_size_changed (screen); meta_verbose ("Changed size for stage on screen %d to %dx%d\n", meta_screen_get_screen_number (screen), width, height); }
void xf_transform_window(xfContext *xfc) { int ret; int w; int h; long supplied; Atom hints_atom; XSizeHints *size_hints = NULL; hints_atom = XInternAtom(xfc->display, "WM_SIZE_HINTS", 1); ret = XGetWMSizeHints(xfc->display, xfc->window->handle, size_hints, &supplied, hints_atom); if(ret == 0) size_hints = XAllocSizeHints(); w = (xfc->originalWidth * xfc->settings->ScalingFactor) + xfc->offset_x; h = (xfc->originalHeight * xfc->settings->ScalingFactor) + xfc->offset_y; if(w < 1) w = 1; if(h < 1) h = 1; if(size_hints) { size_hints->flags |= PMinSize | PMaxSize; size_hints->min_width = size_hints->max_width = w; size_hints->min_height = size_hints->max_height = h; XSetWMNormalHints(xfc->display, xfc->window->handle, size_hints); XResizeWindow(xfc->display, xfc->window->handle, w, h); XFree(size_hints); } }
void DockContainer::embed( WId id ) { if( id == _embeddedWinId || id == 0) return; QRect geom = KWindowSystem::windowInfo(id,NET::WMFrameExtents).frameGeometry(); // does the same as KWindowSystem::prepareForSwallowing() QX11Info info; XWithdrawWindow( QX11Info::display(), id, info.screen() ); while( KWindowSystem::windowInfo(id, NET::XAWMState).mappingState() != NET::Withdrawn ); XReparentWindow( QX11Info::display(), id, winId(), 0, 0 ); // resize if window is bigger than frame if( (geom.width() > width()) || (geom.height() > height()) ) XResizeWindow( QX11Info::display(), id, width(), height() ); else XMoveWindow(QX11Info::display(), id, (sz() - geom.width())/2 - border(), (sz() - geom.height())/2 - border()); XMapWindow( QX11Info::display(), id ); XUngrabButton( QX11Info::display(), AnyButton, AnyModifier, winId() ); _embeddedWinId = id; }
void X11Window::resize(const Size& size) { if(size.width() < m_minimumSize.width() || size.height() < m_minimumSize.height()) return; XResizeWindow(m_display, m_window, size.width(), size.height()); XFlush(m_display); }
void MFDisplay_ResetDisplay() { MFCALLSTACK; sizeHints->flags = PSize | PMinSize | PMaxSize; sizeHints->min_width = sizeHints->max_width = sizeHints->base_width = gDisplay.width; sizeHints->min_height = sizeHints->max_height = sizeHints->base_height = gDisplay.height; XSetWMNormalHints(xdisplay, window, sizeHints); XResizeWindow(xdisplay, window, gDisplay.width, gDisplay.height); if(!gDisplay.windowed && numModes > 1) { XF86VidModeSwitchToMode(xdisplay, screen, vidModes[currentMode]); XGrabPointer(xdisplay, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, None, CurrentTime); XFlush(xdisplay); // A little trick to make sure the entire window is on the screen XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, gDisplay.width - 1, gDisplay.height - 1); XWarpPointer(xdisplay, None, window, 0, 0, 0, 0, 0, 0); XFlush(xdisplay); } MFRenderer_ResetDisplay(); }
static void mpl_panel_clutter_set_size (MplPanelClient *self, guint width, guint height) { MplPanelClutterPrivate *priv = MPL_PANEL_CLUTTER (self)->priv; Display *xdpy = clutter_x11_get_default_display (); XSizeHints hints; MplPanelClientClass *p_class; p_class = MPL_PANEL_CLIENT_CLASS (mpl_panel_clutter_parent_class); clutter_actor_set_size (priv->stage, width, height); mpl_panel_clutter_ensure_window ((MplPanelClutter*)self); hints.min_width = width; hints.min_height = height; hints.flags = PMinSize; MPL_X_ERROR_TRAP (); XSetWMNormalHints (xdpy, priv->xwindow, &hints); XResizeWindow (xdpy, priv->xwindow, width, height); MPL_X_ERROR_UNTRAP (); clutter_stage_ensure_viewport (CLUTTER_STAGE (priv->stage)); if (p_class->set_size) p_class->set_size (self, width, height); }
void X11EGLWindow::resize(uint width, uint height) { if (mClosed) { return; } if (mWidth == width && mHeight == height) { return; } if (width != 0 && height != 0) { if (mIsTopLevel) { XResizeWindow((Display*)mGLSupport->getNativeDisplay(), (Window)mWindow, width, height); } else { mWidth = width; mHeight = height; for (ViewportList::iterator it = mViewportList.begin(); it != mViewportList.end(); ++it) { (*it).second->_updateDimensions(); } } } }
static void puglResize(PuglView* view) { int set_hints = 1; view->resize = false; if (!view->resizeFunc) { return; } /* ask the plugin about the new size */ view->resizeFunc(view, &view->width, &view->height, &set_hints); XSizeHints *hints = XAllocSizeHints(); hints->min_width = view->width; hints->min_height = view->height; hints->max_width = view->user_resizable ? 2048 : view->width; hints->max_height = view->user_resizable ? 2048 : view->height; hints->flags = PMaxSize | PMinSize; if (set_hints) { XSetWMNormalHints(view->impl->display, view->impl->win, hints); } XResizeWindow(view->impl->display, view->impl->win, view->width, view->height); XFlush(view->impl->display); XFree(hints); #ifdef VERBOSE_PUGL printf("puGL: window resize (%dx%d)\n", view->width, view->height); #endif /* and call Reshape in glX context */ puglReshape(view, view->width, view->height); }
Bool container_client_add(container_t *container, client_t *client) { XWindowAttributes attr; int ret; container_t *tmp = NULL; ret = XFindContext(container->wm->dpy, client->window, container_context, (XPointer*)&tmp); if (ret != XCNOENT) { wm_log(container->wm, LOG_INFO, "%s: ignoring attempt to add container as a client: %d", __func__, client->window); return False; } /* Ignore the add if this window already belongs to a container */ ret = XFindContext(container->wm->dpy, client->window, client_container_context, (XPointer*)&tmp); if (ret != XCNOENT) { wm_log(container->wm, LOG_INFO, "%s: window %d already in a container, ignoring mapnotify", __func__, client->window); return False; } wm_log(container->wm, LOG_INFO, "%s: client add window %d", __func__, client->window); XAddToSaveSet(container->wm->dpy, client->window); XGetWindowAttributes(container->wm->dpy, container->frame, &attr); XSetWindowBorderWidth(container->wm->dpy, client->window, 0); XSelectInput(container->wm->dpy, client->window, CLIENT_EVENT_MASK); XReparentWindow(container->wm->dpy, client->window, container->frame, 0, TITLE_HEIGHT); XResizeWindow(container->wm->dpy, client->window, attr.width, attr.height - TITLE_HEIGHT); XSaveContext(container->wm->dpy, client->window, client_container_context, (XPointer)container); //container_paint(container); container_client_show(container, client); return True; }
void SetDlgSize(t_dlg *dlg, int w, int h, bool bAutoPosition) { if (bAutoPosition) { int x, y; x = (dlg->xmax-w)/2; y = (dlg->ymax-h)/2; dlg->win.x = x; dlg->win.y = y; } dlg->win.width = w; dlg->win.height = h; #ifdef DEBUG std::fprintf(dlg->x11->console, "SetDlgSize: Dialog is %dx%d, at %d,%d\n", dlg->win.width, dlg->win.height, dlg->win.x, dlg->win.y); dlg->x11->Flush(dlg->x11); #endif if (dlg->win.self) { XMoveWindow(dlg->x11->disp, dlg->win.self, dlg->win.x, dlg->win.y); XResizeWindow(dlg->x11->disp, dlg->win.self, w, h); } }
void shade_client(Client * c) { if(!c->shaded) { c->shaded = 1; XResizeWindow(disp, c->frame, c->width, TITLEBAR_HEIGHT); c->ignore_unmap++; XUnmapWindow(disp, c->window); icccm_set_state(c, IconicState); } else { c->shaded = 0; XMapWindow(disp, c->window); XResizeWindow(disp, c->frame, c->width, c->height + TITLEBAR_HEIGHT); icccm_set_state(c, NormalState); } }
void FWindow::Linux_SetResolution(GLuint Width, GLuint Height) { Resolution[0] = Width; Resolution[1] = Height; XResizeWindow(WindowManager::GetDisplay(), WindowHandle, Resolution[0], Resolution[1]); }
void subTrayUpdate(void) { subtle->panels.tray.width = 0; ///< Reset width if(0 < subtle->trays->ndata) { int i; /* Resize every tray */ for(i = 0, subtle->panels.tray.width = 3; i < subtle->trays->ndata; i++) { SubTray *t = TRAY(subtle->trays->data[i]); if(t->flags & SUB_TRAY_DEAD) continue; XMapWindow(subtle->dpy, t->win); XMoveResizeWindow(subtle->dpy, t->win, subtle->panels.tray.width, 0, t->width, subtle->ph); subtle->panels.tray.width += t->width; } subtle->panels.tray.width += 3; ///< Add padding XMapRaised(subtle->dpy, subtle->windows.tray); XResizeWindow(subtle->dpy, subtle->windows.tray, subtle->panels.tray.width, subtle->ph); } else XUnmapWindow(subtle->dpy, subtle->windows.tray); } /* }}} */
void X11Window::set_size(int width, int height, bool size_is_client_area) { update_frame_extents(); if (!resize_allowed) // If resize has been disabled, we have to temporary enable it { long user_hints; XGetWMNormalHints(handle.display, handle.window, size_hints, &user_hints); size_hints->flags &= ~(PMinSize | PMaxSize); XSetWMNormalHints(handle.display, handle.window, size_hints); } if (!size_is_client_area) { width = std::max(_ResizeMinimumSize_, width - frame_extents.left - frame_extents.right); height = std::max(_ResizeMinimumSize_, height - frame_extents.top - frame_extents.bottom); } auto new_client_area = Rect::xywh(client_area.left, client_area.top, width, height); XResizeWindow(handle.display, handle.window, width, height); if (!resize_allowed) // resize has been temporary enabled { size_hints->min_width = width; size_hints->min_height = height; size_hints->max_width = width; size_hints->max_height = height; size_hints->flags |= PMinSize | PMaxSize; XSetWMNormalHints(handle.display, handle.window, size_hints); } process_window_resize(new_client_area); }
void neo_draw_window_resize(NeoDrawWindow *win, int width, int height) { if(!win) return; XResizeWindow(win->handle->display, win->id, width, height); }
void W_ResizeView(W_View * view, unsigned int width, unsigned int height) { /*int shrinked; */ if (view->delegate && view->delegate->willResize) { (*view->delegate->willResize) (view->delegate, view, &width, &height); } assert(width > 0); assert(height > 0); if (view->size.width == width && view->size.height == height) return; /*shrinked = width < view->size.width || height < view->size.height; */ if (view->flags.realized) { XResizeWindow(view->screen->display, view->window, width, height); } view->size.width = width; view->size.height = height; if (view->delegate && view->delegate->didResize) { (*view->delegate->didResize) (view->delegate, view); } /* // TODO. replace in WINGs code, with the didResize delegate */ if (view->flags.notifySizeChanged) WMPostNotificationName(WMViewSizeDidChangeNotification, view, NULL); }
void handle_maprequest(XEvent *evt) { XMapRequestEvent * mre = &(evt->xmaprequest); XWindowAttributes attr; if (init_stage == 1) { init_stage = 2; XGetWindowAttributes(gdi.display, mre->window, &attr); init_tabbar(attr.width); the_bar.x=0; the_bar.y = attr.height; realize_tab_bar(gdi.mainw); XResizeWindow(gdi.display, gdi.mainw, attr.width, attr.height + the_bar.height); match_size_hints(mre->window, the_bar.height); new_tab(mre->window); } else if(the_bar.win == mre->window) { } else { /* it's our new child */ XMoveResizeWindow(gdi.display, mre->window, 0, tab_options.tabs_on_top?the_bar.height:0, gdi.width, gdi.height - the_bar.height); new_tab(mre->window); } XMapWindow(gdi.display, mre->window); }
static void prompt_resize(ObPrompt *self, gint w, gint h) { XConfigureRequestEvent req; XSizeHints hints; self->width = w; self->height = h; /* the user can't resize the prompt */ hints.flags = PMinSize | PMaxSize; hints.min_width = hints.max_width = w; hints.min_height = hints.max_height = h; XSetWMNormalHints(obt_display, self->super.window, &hints); if (self->mapped) { /* send a configure request like a normal client would */ req.type = ConfigureRequest; req.display = obt_display; req.parent = obt_root(ob_screen); req.window = self->super.window; req.width = w; req.height = h; req.value_mask = CWWidth | CWHeight; XSendEvent(req.display, req.window, FALSE, StructureNotifyMask, (XEvent*)&req); } else XResizeWindow(obt_display, self->super.window, w, h); }
int window_move_resize( Display * disp, Window win, char *arg ) { /*{{{ */ signed long grav, x, y, w, h; unsigned long grflags; const char *argerr = "The -e option expects a list of comma separated integers: \"gravity,X,Y,width,height\"\n"; if ( !arg || strlen( arg ) == 0 ) { fputs( argerr, stderr ); return EXIT_FAILURE; } if ( sscanf( arg, "%ld,%ld,%ld,%ld,%ld", &grav, &x, &y, &w, &h ) != 5 ) { fputs( argerr, stderr ); return EXIT_FAILURE; } if ( grav < 0 ) { fputs( "Value of gravity mustn't be negative. Use zero to use the default gravity of the window.\n", stderr ); return EXIT_FAILURE; } grflags = grav; if ( x != -1 ) grflags |= ( 1 << 8 ); if ( y != -1 ) grflags |= ( 1 << 9 ); if ( w != -1 ) grflags |= ( 1 << 10 ); if ( h != -1 ) grflags |= ( 1 << 11 ); p_verbose( "grflags: %lu\n", grflags ); if ( wm_supports( disp, "_NET_MOVERESIZE_WINDOW" ) ) { return client_msg( disp, win, "_NET_MOVERESIZE_WINDOW", grflags, ( unsigned long ) x, ( unsigned long ) y, ( unsigned long ) w, ( unsigned long ) h ); } else { p_verbose( "WM doesn't support _NET_MOVERESIZE_WINDOW. Gravity will be ignored.\n" ); if ( ( w < 1 || h < 1 ) && ( x >= 0 && y >= 0 ) ) { XMoveWindow( disp, win, x, y ); } else if ( ( x < 0 || y < 0 ) && ( w >= 1 && h >= -1 ) ) { XResizeWindow( disp, win, w, h ); } else if ( x >= 0 && y >= 0 && w >= 1 && h >= 1 ) { XMoveResizeWindow( disp, win, x, y, w, h ); } return EXIT_SUCCESS; } }
static void Set_Window_Size_f( void){ int width, height; char *arg; char *endnum; if( Cmd_Argc() != 3){ Com_Printf( "usage: xil_set_window_size width height\n"); return; } arg = Cmd_Argv( 1); width = strtol( arg, &endnum, 10); if( endnum != arg && *endnum != 0){ Com_Printf( "illegal width\n"); return; } arg = Cmd_Argv( 2); height = strtol( arg, &endnum, 10); if( endnum != arg && *endnum != 0){ Com_Printf( "illegal height\n"); return; } XResizeWindow( x_disp, x_win, width, height); }
void resize(int w, int h) { if (w == width && h == height) { return; } glXWaitGL(); // 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); // 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(ConfigureNotify); glXWaitX(); }
egl::Error WindowSurfaceGLX::swap() { //TODO(cwallez) set up our own error handler to see if the call failed unsigned int newParentWidth, newParentHeight; if (!getWindowDimensions(mParent, &newParentWidth, &newParentHeight)) { // TODO(cwallez) What error type here? return egl::Error(EGL_BAD_CURRENT_SURFACE, "Failed to retrieve the size of the parent window."); } if (mParentWidth != newParentWidth || mParentHeight != newParentHeight) { mParentWidth = newParentWidth; mParentHeight = newParentHeight; mGLX.waitGL(); XResizeWindow(mDisplay, mWindow, mParentWidth, mParentHeight); mGLX.waitX(); } mGLXDisplay->setSwapInterval(mGLXWindow, &mSwapControl); mGLX.swapBuffers(mGLXWindow); return egl::Error(EGL_SUCCESS); }
static void move_bbox(t_x11 *x11, t_butbox *bbox) { int x0, y0; int i, bw; real idb, bh, one = 1.0; t_windata *wd; bw = std::max(1, bbox->wd.width-2*(AIR+BORDER)); idb = bbox->nbut; bh = (bbox->wd.height-AIR*(bbox->nbut+1)); bh /= idb; bh = std::max(bh, one); x0 = AIR; y0 = AIR; for (i = 0; (i < bbox->nbut); i++) { wd = &(bbox->b[i].wd); wd->width = bw; wd->height = bh; wd->color = WHITE; XMoveWindow(x11->disp, wd->self, x0, y0); XResizeWindow(x11->disp, wd->self, wd->width, wd->height); y0 += AIR+bh; } }
void XxWindow::SetSize (int Width, int Height) { Hints.width = Width; Hints.height = Height; XResizeWindow (GetDisplay (), Xid, Width, Height); };
// ---------------------------------------------------------------------------------------------- // Resize window to sx, sy. // ---------------------------------------------------------------------------------------------- void wsResizeWindow( wsTWindow * win,int sx, int sy ) { win->Width=sx; win->Height=sy; win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize; win->SizeHint.x=win->X; win->SizeHint.y=win->Y; win->SizeHint.width=win->Width; win->SizeHint.height=win->Height; if ( win->Property & wsMinSize ) { win->SizeHint.flags|=PMinSize; win->SizeHint.min_width=win->Width; win->SizeHint.min_height=win->Height; } if ( win->Property & wsMaxSize ) { win->SizeHint.flags|=PMaxSize; win->SizeHint.max_width=win->Width; win->SizeHint.max_height=win->Height; } win->SizeHint.win_gravity=StaticGravity; win->SizeHint.base_width=sx; win->SizeHint.base_height=sy; if ( vo_wm_type == 0 ) XUnmapWindow( wsDisplay,win->WindowID ); XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); XResizeWindow( wsDisplay,win->WindowID,sx,sy ); XMapRaised( wsDisplay,win->WindowID ); if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height ); }
void LinuxEnvironment::setWindowResizableInt(bool resizable, Vector2 windowSize) { m_bResizable = resizable; const Vector2 windowPos = getWindowPos(); // window managers may ignore this completely, there is no way to force it XSizeHints wmsize; memset(&wmsize, 0, sizeof(XSizeHints)); wmsize.flags = PMinSize | PMaxSize; wmsize.min_width = m_bResizable ? 100 : (int)windowSize.x; wmsize.min_height = m_bResizable ? 100 : (int)windowSize.y; wmsize.max_width = m_bResizable ? (std::numeric_limits<int>::max() - 1) : (int)windowSize.x; wmsize.max_height = m_bResizable ? (std::numeric_limits<int>::max() - 1) : (int)windowSize.y; XSetWMNormalHints(m_display, m_window, &wmsize); // hack to force update the XSizeHints state XResizeWindow(m_display, m_window, (unsigned int)windowSize.x, (unsigned int)windowSize.y); XMoveWindow(m_display, m_window, (int)windowPos.x, (int)windowPos.y); XRaiseWindow(m_display, m_window); XFlush(m_display); }
static int window_move_resize (Display *disp, Window win, char *arg) {/*{{{*/ signed long x, y, w, h; const char *argerr = "The -e option expects a list of comma separated integers: \"X,Y,width,height\"\n"; if (!arg || strlen(arg) == 0) { fputs(argerr, stderr); return EXIT_FAILURE; } if (sscanf(arg, "%ld,%ld,%ld,%ld", &x, &y, &w, &h) != 4) { fputs(argerr, stderr); return EXIT_FAILURE; } if ((w < 1 || h < 1) && (x >= 0 && y >= 0)) { XMoveWindow(disp, win, x, y); } else if ((x < 0 || y < 0) && (w >= 1 && h >= -1)) { XResizeWindow(disp, win, w, h); } else if (x >= 0 && y >= 0 && w >= 1 && h >= 1) { XMoveResizeWindow(disp, win, x, y, w, h); } return EXIT_SUCCESS; }/*}}}*/
/** * updates the size of the display * @param width the new pixel width of the display * @param height then new pixel height of the display * @return false if an error occurred, otherwise true */ bool lino_display_resize(unit w, unit h) { /* Set the visibility mode of the display */ if (w <= 0 || h <= 0) { if (xw.visible) { /* set the visibility to false. * TODO: display default screen * OR: minimize window */ xw.visible = false; } } else { XResizeWindow(xw.display, xw.window, (int) w, (int) h); xw.width = w; xw.height = h; xw.ximage->width = w; xw.ximage->height = h; xw.ximage->bytes_per_line = w * xw.pixelsize; if (!xw.visible) { /* set the visibility to true. */ xw.visible = true; /* map the window and raise it to the top of the stack */ XMapRaised(xw.display, xw.window); } } return true; }
void GLWindow::Force43Ratio() { #ifndef USE_GSOPEN2 // avoid black border in fullscreen if (fullScreen && conf.isWideScreen) { conf.width = width; conf.height = height; } if(!fullScreen && !conf.isWideScreen) { // Compute the width based on height s32 new_width = (4*height)/3; // do not bother to resize for 5 pixels. Avoid a loop // due to round value if ( abs(new_width - width) > 5) { width = new_width; conf.width = new_width; // resize the window XLockDisplay(glDisplay); XResizeWindow(glDisplay, glWindow, new_width, height); XSync(glDisplay, False); XUnlockDisplay(glDisplay); } } #endif }
Word NewGameWindow(Word NewVidSize) { XSizeHints sizehints; if (NewVidSize == VidSize) return VidSize; if (NewVidSize < 4) { w = VidXs[NewVidSize]; h = VidYs[NewVidSize]; v = VidVs[NewVidSize]; } else { fprintf(stderr, "Invalid Vid size: %d\n", NewVidSize); exit(EXIT_FAILURE); } sizehints.min_width = w; sizehints.min_height = h; sizehints.flags = PMinSize; XSetWMNormalHints(dpy, win, &sizehints); XResizeWindow(dpy, win, w, h); SetAPalette(rBlackPal); ClearTheScreen(BLACK); BlastScreen(); VidSize = NewVidSize; XSync(dpy, False); glXWaitGL(); glXWaitX(); HandleEvents(); return VidSize; }