void change_input_focus(HyperLink *link) { InputItem *new_item = link->reference.string; InputItem *old_item = gWindow->page->current_item; XWindowChanges wc; /** first thing I should do is see if the user has clicked in the same window that I am in ****/ if (old_item == new_item) return; /** Now change the current pointer **/ gWindow->page->current_item = new_item; /** Now I have to change the border width of the selected input window **/ wc.border_width = 1; XConfigureWindow(gXDisplay, new_item->win, CWBorderWidth, &wc); wc.border_width = 0; XConfigureWindow(gXDisplay, new_item->win, CWBorderWidth, &wc); update_inputsymbol(old_item); update_inputsymbol(new_item); }
static void configurerequest(XEvent *e) { unsigned long newmask; Client *c; XConfigureRequestEvent *ev = &e->xconfigurerequest; XWindowChanges wc; if((c = getclient(ev->window))) { c->ismax = False; if(ev->value_mask & CWX) c->x = ev->x; if(ev->value_mask & CWY) c->y = ev->y; if(ev->value_mask & CWWidth) c->w = ev->width; if(ev->value_mask & CWHeight) c->h = ev->height; if(ev->value_mask & CWBorderWidth) c->border = ev->border_width; wc.x = c->x; wc.y = c->y; wc.width = c->w; wc.height = c->h; newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth)); if(newmask) XConfigureWindow(dpy, c->win, newmask, &wc); else configure(c); XSync(dpy, False); if(c->isfloat) { resize(c, False); if(c->view != view) XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); } else arrange(); } else { wc.x = ev->x; wc.y = ev->y; wc.width = ev->width; wc.height = ev->height; wc.border_width = ev->border_width; wc.sibling = ev->above; wc.stack_mode = ev->detail; XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); XSync(dpy, False); } }
void compzillaWindow::SendPendingResize () { if (mIsResizePending) { unsigned changeMask = (mAttr.x != mPendingChanges.x ? CWX : 0) | (mAttr.y != mPendingChanges.y ? CWY : 0) | (mAttr.width != mPendingChanges.width ? CWWidth : 0) | (mAttr.height != mPendingChanges.height ? CWHeight : 0) | (mAttr.border_width != mPendingChanges.border_width ? CWBorderWidth : 0); if (!changeMask) { mIsResizePending = false; return; } SPEW ("SendPendingResize: Calling XConfigureWindow (window=%p, x=%d, y=%d, " "width=%d, height=%d, border=%d)\n", mWindow, mPendingChanges.x, mPendingChanges.y, mPendingChanges.width, mPendingChanges.height, mPendingChanges.border_width); XConfigureWindow (mDisplay, mWindow, changeMask, &mPendingChanges); } }
/* Make the physical stacking position of W match its current position in the stacking list. Tries to stack relative to the window above W before trying the window below W (if there's no window above W). */ void restack_window (Lisp_Window *w) { if (!WINDOW_IS_GONE_P (w)) { XWindowChanges wc; unsigned int mask = 0; return_if_fail (window_in_stacking_list_p (w)); if (w->above != 0) { wc.stack_mode = Below; wc.sibling = stackable_window_id (w->above); mask = CWStackMode | CWSibling; } else if (w->below != 0) { wc.stack_mode = Above; wc.sibling = stackable_window_id (w->below); mask = CWStackMode | CWSibling; } if (mask != 0) XConfigureWindow (dpy, stackable_window_id (w), mask, &wc); } }
// event handler implementations void configurerequest(XEvent* event) { XConfigureRequestEvent* cre = &event->xconfigurerequest; Client* client = get_client_from_window(cre->window); if (client) { XConfigureEvent ce; ce.type = ConfigureNotify; ce.display = gDisplay; ce.event = cre->window; ce.window = cre->window; ce.x = client->last_size.x; ce.y = client->last_size.y; ce.width = client->last_size.width; ce.height = client->last_size.height; ce.override_redirect = False; ce.border_width = cre->border_width; ce.above = cre->above; XSendEvent(gDisplay, cre->window, False, StructureNotifyMask, (XEvent*)&ce); } else { // if client not known.. then allow configure. // its probably a nice conky or dzen2 bar :) XWindowChanges wc; wc.x = cre->x; wc.y = cre->y; wc.width = cre->width; wc.height = cre->height; wc.border_width = cre->border_width; wc.sibling = cre->above; wc.stack_mode = cre->detail; XConfigureWindow(gDisplay, cre->window, cre->value_mask, &wc); } }
int WindowManager::handle(XEvent *e) { switch(e->type) { case ClientMessage: { DBG("WindowManager ClientMessage 0x%lx", e->xclient.window); if(handle_desktop_msgs(&(e->xclient))) return 1; return 0; } case ConfigureRequest: { DBG("WindowManager ConfigureRequest: 0x%lx", e->xconfigurerequest.window); const XConfigureRequestEvent *e = &(fl_xevent.xconfigurerequest); XConfigureWindow(fl_display, e->window, e->value_mask&~(CWSibling|CWStackMode), (XWindowChanges*)&(e->x)); return 1; } case MapRequest: { DBG("WindowManager MapRequest: 0x%lx", e->xmaprequest.window); const XMapRequestEvent* e = &(fl_xevent.xmaprequest); new Frame(e->window); return 1; } } return 0; }
void meta_core_lower_beneath_focus_window (Display *xdisplay, Window xwindow, guint32 timestamp) { XWindowChanges changes; MetaDisplay *display; MetaScreen *screen; MetaWindow *focus_window; display = meta_display_for_x_display (xdisplay); screen = meta_display_screen_for_xwindow (display, xwindow); focus_window = meta_stack_get_top (screen->stack); if (focus_window == NULL) return; changes.stack_mode = Below; changes.sibling = focus_window->frame ? focus_window->frame->xwindow : focus_window->xwindow; meta_error_trap_push (display); XConfigureWindow (xdisplay, xwindow, CWSibling | CWStackMode, &changes); meta_error_trap_pop (display, FALSE); }
XtEventHandler Configure( Widget w, caddr_t client_data, XEvent *event, Boolean *cont) { Window root; int xr, yr; unsigned int dr, wr, hr, bwr; unsigned long valuemask; XWindowChanges xswa; Window window = (Window) client_data; if (event != NULL && event->type != ConfigureNotify) return; (void)XGetGeometry( GdDisplay, XtWindow(w), &root, &xr, &yr, &wr, &hr, &bwr, &dr); valuemask = 0; xswa.width = wr; valuemask |= CWWidth; xswa.height = hr; valuemask |= CWHeight; xswa.stack_mode = Above; valuemask |= CWStackMode; XConfigureWindow( GdDisplay, window, valuemask, &xswa); XRaiseWindow( GdDisplay, window); }
/* FIXME - We shouldn't go here */ EXidDel(win); #if 1 /* Debug - Fix code if we get here */ Eprintf("*** FIXME - EUnregisterXwin %#lx\n", xwin); #endif } void EUnregisterWindow(Win win) { if (!win) return; if (win->cbl.lst) { if (EDebug(1)) Eprintf("EUnregisterWindow(%#lx) Ignored (%d callbacks remain)\n", win->xwin, win->cbl.num); return; } EXidDel(win); } void EMapWindow(Win win) { if (!win) return; if (win->mapped) return; win->mapped = 1; XMapWindow(disp, win->xwin); } void EUnmapWindow(Win win) { if (!win) return; if (!win->mapped) return; win->mapped = 0; XUnmapWindow(disp, win->xwin); } void EReparentWindow(Win win, Win parent, int x, int y) { if (!win) return; #if 0 Eprintf ("EReparentWindow: %p %#lx: %d %#lx->%#lx %d,%d %dx%d -> %d,%d\n", win, win->xwin, win->mapped, (win->parent) ? win->parent->xwin : None, parent->xwin, win->x, win->y, win->w, win->h, x, y); #endif if (parent == win->parent) { if ((x != win->x) || (y != win->y)) { win->x = x; win->y = y; XMoveWindow(disp, win->xwin, x, y); } return; } else { win->parent = parent; win->x = x; win->y = y; } XReparentWindow(disp, win->xwin, parent->xwin, x, y); } void EMapRaised(Win win) { if (!win) return; if (win->mapped) { XRaiseWindow(disp, win->xwin); return; } else { win->mapped = 1; } XMapRaised(disp, win->xwin); } int EXGetGeometry(Drawable draw, Window * root_return, int *x, int *y, int *w, int *h, int *bw, int *depth) { int ok; Window rr; int xx, yy; unsigned int ww, hh, bb, dd; ok = XGetGeometry(disp, draw, &rr, &xx, &yy, &ww, &hh, &bb, &dd); if (!ok) goto done; if (root_return) *root_return = rr; if (x) *x = xx; if (y) *y = yy; if (w) *w = ww; if (h) *h = hh; if (bw) *bw = bb; if (depth) *depth = dd; done: #if 0 /* Debug */ if (!ok) Eprintf("EGetGeometry win=%#x, error %d\n", (unsigned)win, ok); #endif return ok; } int EGetGeometry(Win win, Window * root_return, int *x, int *y, int *w, int *h, int *bw, int *depth) { if (!win) return 0; if (x) *x = win->x; if (y) *y = win->y; if (w) *w = win->w; if (h) *h = win->h; if (bw) *bw = 0; if (depth) *depth = win->depth; if (root_return) *root_return = WinGetXwin(VROOT); return 1; } void EGetWindowAttributes(Win win, XWindowAttributes * pxwa) { if (!win) return; pxwa->x = win->x; pxwa->y = win->y; pxwa->width = win->w; pxwa->height = win->h; pxwa->border_width = win->bw; pxwa->depth = win->depth; pxwa->visual = win->visual; pxwa->colormap = win->cmap; } #if 0 /* Unused */ void EConfigureWindow(Win win, unsigned int mask, XWindowChanges * wc) { char doit = 0; if (!win) return; if ((mask & CWX) && (wc->x != win->x)) { win->x = wc->x; doit = 1; } if ((mask & CWY) && (wc->y != win->y)) { win->y = wc->y; doit = 1; } if ((mask & CWWidth) && (wc->width != win->w)) { WinBgInvalidate(win); win->w = wc->width; doit = 1; } if ((mask & CWHeight) && (wc->height != win->h)) { WinBgInvalidate(win); win->h = wc->height; doit = 1; } if ((doit) || (mask & (CWBorderWidth | CWSibling | CWStackMode))) XConfigureWindow(disp, win->xwin, mask, wc); }
void meta_core_lower_beneath_grab_window (Display *xdisplay, Window xwindow, guint32 timestamp) { XWindowChanges changes; MetaDisplay *display; MetaScreen *screen; MetaWindow *grab_window; display = meta_display_for_x_display (xdisplay); screen = meta_display_screen_for_xwindow (display, xwindow); grab_window = display->grab_window; if (grab_window == NULL) return; changes.stack_mode = Below; changes.sibling = grab_window->frame ? grab_window->frame->xwindow : grab_window->xwindow; meta_stack_tracker_record_lower_below (screen->stack_tracker, xwindow, changes.sibling, XNextRequest (screen->display->xdisplay)); meta_error_trap_push (display); XConfigureWindow (xdisplay, xwindow, CWSibling | CWStackMode, &changes); meta_error_trap_pop (display); }
LOCAL_SYMBOL void meta_core_lower_beneath_sibling (Display *xdisplay, Window xwindow, Window grab_window, guint32 timestamp) { XWindowChanges changes; MetaDisplay *display; MetaScreen *screen; display = meta_display_for_x_display (xdisplay); screen = meta_display_screen_for_xwindow (display, xwindow); changes.stack_mode = Below; changes.sibling = grab_window; meta_stack_tracker_record_lower_below (screen->stack_tracker, xwindow, changes.sibling, XNextRequest (screen->display->xdisplay)); meta_error_trap_push (display); XConfigureWindow (xdisplay, xwindow, CWSibling | CWStackMode, &changes); meta_error_trap_pop (display); }
void winresize(pdfapp_t *app, int w, int h) { XWindowChanges values; int mask; mask = CWWidth | CWHeight; values.width = w; values.height = h; XConfigureWindow(xdpy, xwin, mask, &values); reqw = w; reqh = h; if (!mapped) { gapp.winw = w; gapp.winh = h; XMapWindow(xdpy, xwin); XFlush(xdpy); while (1) { XNextEvent(xdpy, &xevt); if (xevt.type == MapNotify) break; } XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr)); XFillRectangle(xdpy, xwin, xgc, 0, 0, gapp.image->w, gapp.image->h); XFlush(xdpy); mapped = 1; } }
void XtResizeWindow( Widget w) { XtConfigureHookDataRec req; Widget hookobj; WIDGET_TO_APPCON(w); LOCK_APP(app); if (XtIsRealized(w)) { req.changes.width = w->core.width; req.changes.height = w->core.height; req.changes.border_width = w->core.border_width; req.changeMask = CWWidth | CWHeight | CWBorderWidth; XConfigureWindow(XtDisplay(w), XtWindow(w), (unsigned) req.changeMask, &req.changes); hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));; if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) { req.type = XtHconfigure; req.widget = w; XtCallCallbackList(hookobj, ((HookObject)hookobj)->hooks.confighook_callbacks, (XtPointer)&req); } } UNLOCK_APP(app); } /* XtResizeWindow */
EAPI void ecore_x_window_configure(Ecore_X_Window win, Ecore_X_Window_Configure_Mask mask, int x, int y, int w, int h, int border_width, Ecore_X_Window sibling, int stack_mode) { XWindowChanges xwc; if (!win) return; LOGFN(__FILE__, __LINE__, __FUNCTION__); xwc.x = x; xwc.y = y; xwc.width = w; xwc.height = h; xwc.border_width = border_width; xwc.sibling = sibling; xwc.stack_mode = stack_mode; XConfigureWindow(_ecore_x_disp, win, mask, &xwc); }
static void show_input(TextNode *node) { /*XFontStruct *old_font;*/ XWindowChanges wc; /*int twidth, boxwidth, old_color;*/ /*Window root, child;*/ /*int root_x, root_y, win_x, win_y, buttons;*/ InputItem *item; char *inpbuffer; item = node->link->reference.string; inpbuffer = item->curr_line->buffer; wc.border_width = 0; wc.x = node->x; wc.y = node->y + gRegionOffset + y_off - node->height + 2; wc.height = node->height - 2; wc.width = node->width; if (pix_visible(node->y, node->height)) { XConfigureWindow(gXDisplay, node->link->win, CWX | CWY | CWHeight | CWWidth | CWBorderWidth, &wc); XMapWindow(gXDisplay, node->link->win); } XFlush(gXDisplay); draw_inputsymbol(item); }
static void x11_apply_video_params(VideoParams *params, Window window){ XWindowChanges wc; unsigned int flags=0; static Display *display = NULL; const char *dname=getenv("DISPLAY"); if (display==NULL && dname!=NULL){ XInitThreads(); display=XOpenDisplay(dname); } if (display==NULL){ ms_error("Could not open display %s",dname); return; } memset(&wc,0,sizeof(wc)); wc.x=params->x; wc.y=params->y; wc.width=params->w; wc.height=params->h; if (params->x!=-1 ){ flags|=CWX|CWY; } if (params->w!=-1){ flags|=CWWidth|CWHeight; } /*printf("XConfigureWindow x=%i,y=%i,w=%i,h=%i\n", wc.x, wc.y ,wc.width, wc.height);*/ XConfigureWindow(display,window,flags,&wc); if (params->show) XMapWindow(display,window); else XUnmapWindow(display,window); XSync(display,FALSE); }
static void handle_configure_request(XConfigureRequestEvent *ev) { WClientWin *cwin; XWindowChanges wc; cwin=find_clientwin(ev->window); if(cwin==NULL){ wc.border_width=ev->border_width; wc.sibling=None; wc.stack_mode=ev->detail; wc.x=ev->x; wc.y=ev->y; wc.width=ev->width; wc.height=ev->height; XConfigureWindow(wglobal.dpy, ev->window, ev->value_mask, &wc); return; } if((ev->value_mask&(CWWidth|CWHeight|CWBorderWidth))!=0){ /* Transients will not get resized properly unless the * wanted sizes are first set and later modified to fit */ if(ev->value_mask&CWWidth) cwin->geom.w=ev->width; if(ev->value_mask&CWHeight) cwin->geom.h=ev->height; if(ev->value_mask&CWBorderWidth) cwin->orig_bw=ev->border_width; refit(cwin, cwin->geom.w, cwin->geom.h); }else{ sendconfig_clientwin(cwin); } }
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height) { Window xwindow = (Window) m_mainWindow; wxCHECK_RET( xwindow, wxT("invalid window") ); #if !wxUSE_NANOX XMoveResizeWindow( wxGlobalDisplay(), xwindow, x, y, width, height ); if (m_mainWindow != m_clientWindow) { xwindow = (Window) m_clientWindow; wxWindow *window = (wxWindow*) this; wxRenderer *renderer = window->GetRenderer(); if (renderer) { wxRect border = renderer->GetBorderDimensions( (wxBorder)(m_windowStyle & wxBORDER_MASK) ); x = border.x; y = border.y; width -= border.x + border.width; height -= border.y + border.height; } else { x = 0; y = 0; } wxScrollBar *sb = window->GetScrollbar( wxHORIZONTAL ); if (sb && sb->IsShown()) { wxSize size = sb->GetSize(); height -= size.y; } sb = window->GetScrollbar( wxVERTICAL ); if (sb && sb->IsShown()) { wxSize size = sb->GetSize(); width -= size.x; } XMoveResizeWindow( wxGlobalDisplay(), xwindow, x, y, wxMax(1, width), wxMax(1, height) ); } #else XWindowChanges windowChanges; windowChanges.x = x; windowChanges.y = y; windowChanges.width = width; windowChanges.height = height; windowChanges.stack_mode = 0; int valueMask = CWX | CWY | CWWidth | CWHeight; XConfigureWindow( wxGlobalDisplay(), xwindow, valueMask, &windowChanges ); #endif }
static Object P_Configure_Window (Object w, Object conf) { unsigned long mask; Check_Type (w, T_Window); mask = Vector_To_Record (conf, Conf_Size, Sym_Conf, Conf_Rec); XConfigureWindow (WINDOW(w)->dpy, WINDOW(w)->win, mask, &WC); return Void; }
bool MMSFB::resizeWindow() { printf("resize w,h: %d,%d\n", this->target_window_w, this->target_window_h ); XWindowChanges chg; chg.width=this->target_window_w; chg.height=this->target_window_h; printf("rc %d\n",XConfigureWindow(this->x_display, this->x_window,CWWidth|CWHeight, &chg)); //XMoveResizeWindow(this->x_display, this->x_window, this->target_window_w, this->target_window_h); return true; }
static void reconfig_window(void) { Dimension x_top, y_top, h_top, w_top; XWindowChanges sizeconfigure; int sizeconfiguremask; /* brute-force method to bring the scrollbars back. Apparently a single XConfigureWindow() isn't enough to get the scrollbars back, we actually need to move the window a bit, and then move it back. */ sizeconfiguremask = CWWidth | CWHeight; XtVaGetValues(globals.widgets.top_level, XtNx, &x_top, XtNy, &y_top, XtNheight, &h_top, XtNwidth, &w_top, NULL); sizeconfigure.width = w_top + 1; sizeconfigure.height = h_top + 1; XConfigureWindow(DISP, XtWindow(globals.widgets.top_level), sizeconfiguremask, &sizeconfigure); sizeconfigure.width = w_top; sizeconfigure.height = h_top; XConfigureWindow(DISP, XtWindow(globals.widgets.top_level), sizeconfiguremask, &sizeconfigure); }
void Window::setDimensions (int width, int height) { const unsigned int mask = CWWidth | CWHeight; XWindowChanges changes; changes.width = width; changes.height = height; XConfigureWindow(m_display.getXDisplay(), m_window, mask, &changes); }
int WindowManager::handle(XEvent* event) { switch(event->type) { /* ClientMessage is only used for desktop handling * and startup notifications. */ case ClientMessage: { ELOG("ClientMessage in wm"); if(event->xclient.message_type == _XA_EDE_WM_STARTUP_NOTIFY) { Atom data = event->xclient.data.l[0]; if(data == _XA_EDE_WM_APP_STARTING) { app_starting = true; cur->set_root_cursor(CURSOR_WAIT); } } return 1; } case MapRequest: { ELOG("MapRequest from wm"); const XMapRequestEvent* e = &(fl_xevent.xmaprequest); XWindowAttributes attrs; XGetWindowAttributes(fl_display, e->window, &attrs); if(!attrs.override_redirect) { ELOG("--- map from wm ---"); new Frame(e->window); if(app_starting) { cur->set_root_cursor(CURSOR_DEFAULT); app_starting = false; } } return 1; } case ConfigureRequest: { ELOG("ConfigureRequest from wm"); const XConfigureRequestEvent *e = &(fl_xevent.xconfigurerequest); XConfigureWindow(fl_display, e->window, e->value_mask&~(CWSibling|CWStackMode), (XWindowChanges*)&(e->x)); return 1; } default: return 0; } return 0; }
void x_resize_window(Display *dsp, Window win, int x, int y) { XWindowChanges values; values.width = x; values.height = y; XConfigureWindow(dsp, win, CWWidth | CWHeight, &values); }
void X11Support::activateWindow(unsigned long window) { XWindowChanges wc; wc.stack_mode = Above; XConfigureWindow(QX11Info::display(), window, CWStackMode, &wc); // Apparently, KWin won't bring window to top with configure request, // so we also need to ask it politely by sending a message. sendNETWMMessage(window, "_NET_ACTIVE_WINDOW", 2, CurrentTime); }
void x11_window_set_position(hwrbitmap window, s16 x, s16 y) { struct x11bitmap *xb = XB(window)->frontbuffer ? XB(window)->frontbuffer : XB(window); XWindowChanges wc; if (VID(is_rootless)()) { wc.x = x; wc.y = y; XConfigureWindow(x11_display, xb->d, CWX | CWY, &wc); } }
void FWindow::Linux_SetPosition(GLuint X, GLuint Y) { XWindowChanges l_WindowChanges; l_WindowChanges.x = X; l_WindowChanges.y = Y; XConfigureWindow( WindowManager::GetDisplay(), WindowHandle, CWX | CWY, &l_WindowChanges); }
void XLibWrapper::configureWindow( XConfigureRequestEvent* event ) { Window window = event->window; XWindowChanges windowChanges; windowChanges.width = event->width; windowChanges.height = event->height; windowChanges.border_width = 0; event->value_mask |= CWBorderWidth; XConfigureWindow( _display, window, event->value_mask, &windowChanges ); }
void winresize(pdfapp_t *app, int w, int h) { int image_w = fz_pixmap_width(gapp.ctx, gapp.image); int image_h = fz_pixmap_height(gapp.ctx, gapp.image); XWindowChanges values; int mask, width, height; mask = CWWidth | CWHeight; values.width = w; values.height = h; XConfigureWindow(xdpy, xwin, mask, &values); reqw = w; reqh = h; if (!mapped) { gapp.winw = w; gapp.winh = h; width = -1; height = -1; XMapWindow(xdpy, xwin); XFlush(xdpy); while (1) { XNextEvent(xdpy, &xevt); if (xevt.type == ConfigureNotify) { width = xevt.xconfigure.width; height = xevt.xconfigure.height; } if (xevt.type == MapNotify) break; } XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr)); XFillRectangle(xdpy, xwin, xgc, 0, 0, image_w, image_h); XFlush(xdpy); if (width != reqw || height != reqh) { gapp.shrinkwrap = 0; dirty = 1; pdfapp_onresize(&gapp, width, height); } mapped = 1; } }
void xwindow_restack(Window win, Window other, int stack_mode) { XWindowChanges wc; int wcmask; wcmask=CWStackMode; wc.stack_mode=stack_mode; if(other!=None){ wc.sibling=other; wcmask|=CWSibling; } XConfigureWindow(ioncore_g.dpy, win, wcmask, &wc); }