void TkpClaimFocus( TkWindow *topLevelPtr, /* Top-level window containing desired focus * window; should be embedded. */ int force) /* One means that the container should claim * the focus if it doesn't currently have * it. */ { XEvent event; Container *containerPtr; if (!(topLevelPtr->flags & TK_EMBEDDED)) { return; } for (containerPtr = firstContainerPtr; containerPtr->embeddedPtr != topLevelPtr; containerPtr = containerPtr->nextPtr) { /* Empty loop body. */ } event.xfocus.type = FocusIn; event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display); event.xfocus.send_event = 1; event.xfocus.display = topLevelPtr->display; event.xfocus.window = containerPtr->parent; event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS; event.xfocus.detail = force; Tk_QueueWindowEvent(&event,TCL_QUEUE_TAIL); }
void XmRedisplayWidget(Widget widget) { XExposeEvent xev ; Region region ; xev.type = Expose ; /* is this better than 0 ? shouldn't make much difference unless the expose method is very tricky... */ xev.serial = LastKnownRequestProcessed(XtDisplay(widget)) ; xev.send_event = False ; xev.display = XtDisplay(widget); xev.window = XtWindowOfObject(widget); /* work with gadget too */ xev.x = 0 ; xev.y = 0 ; xev.width = widget->core.width ; xev.height = widget->core.height ; xev.count = 0 ; region = XCreateRegion(); XtAddExposureToRegion((XEvent*)&xev, region); if (widget->core.widget_class->core_class.expose) (*(widget->core.widget_class->core_class.expose)) (widget, (XEvent*)&xev, region); XDestroyRegion(region); }
static void GenerateFocusEvents( TkWindow *sourcePtr, /* Window that used to have the focus (may be * NULL). */ TkWindow *destPtr) /* New window to have the focus (may be * NULL). */ { XEvent event; TkWindow *winPtr; winPtr = sourcePtr; if (winPtr == NULL) { winPtr = destPtr; if (winPtr == NULL) { return; } } event.xfocus.serial = LastKnownRequestProcessed(winPtr->display); event.xfocus.send_event = GENERATED_FOCUS_EVENT_MAGIC; event.xfocus.display = winPtr->display; event.xfocus.mode = NotifyNormal; TkInOutEvents(&event, sourcePtr, destPtr, FocusOut, FocusIn, TCL_QUEUE_MARK); }
static void HandlePreviewStatus( DPSContext context, int status) { unsigned long serial; Display *dpy; StatusInfo *info = StatusList; while (info != NULL && info->ctxt != context) info = info->next; if (info == NULL) return; (void) XDPSXIDFromContext(&dpy, context); serial = LastKnownRequestProcessed(dpy); /* This event is from before our imaging; send to old status proc. */ if (serial < info->startReqNum) { (*info->oldProc) (context, status); return; } /* This event is from during our imaging; ignore it */ if (serial < info->endReqNum) return; /* This event is juuuuust right. */ if (status == PSFROZEN) *info->doneFlag = True; }
/* *--------------------------------------------------------------------------- * * DoConfigureNotify -- * * Generate a ConfigureNotify event describing the current configuration * of a window. * * Results: * None. * * Side effects: * An event is generated and processed by Tk_HandleEvent. * *--------------------------------------------------------------------------- */ static void DoConfigureNotify(Tk_FakeWin *winPtr) /* Window whose configuration * was just changed. */ { XEvent event; event.type = ConfigureNotify; event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display); event.xconfigure.send_event = False; event.xconfigure.display = winPtr->display; event.xconfigure.event = winPtr->window; event.xconfigure.window = winPtr->window; event.xconfigure.x = winPtr->changes.x; event.xconfigure.y = winPtr->changes.y; event.xconfigure.width = winPtr->changes.width; event.xconfigure.height = winPtr->changes.height; event.xconfigure.border_width = winPtr->changes.border_width; if (winPtr->changes.stack_mode == Above) { event.xconfigure.above = winPtr->changes.sibling; } else { event.xconfigure.above = None; } event.xconfigure.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); }
/** * Xlib-based handling of xcb events for glamor. * * We need to let the Xlib event filtering run on the event so that * Mesa's dri2_glx.c userspace event mangling gets run, and we * correctly get our invalidate events propagated into the driver. */ void ephyr_glamor_process_event(xcb_generic_event_t *xev) { uint32_t response_type = xev->response_type & 0x7f; /* Note the types on wire_to_event: there's an Xlib XEvent (with * the broken types) that it returns, and a protocol xEvent that * it inspects. */ Bool (*wire_to_event)(Display *dpy, XEvent *ret, xEvent *event); XLockDisplay(dpy); /* Set the event handler to NULL to get access to the current one. */ wire_to_event = XESetWireToEvent(dpy, response_type, NULL); if (wire_to_event) { XEvent processed_event; /* OK they had an event handler. Plug it back in, and call * through to it. */ XESetWireToEvent(dpy, response_type, wire_to_event); xev->sequence = LastKnownRequestProcessed(dpy); wire_to_event(dpy, &processed_event, (xEvent *)xev); } XUnlockDisplay(dpy); }
void TkpClaimFocus( TkWindow *topLevelPtr, /* Top-level window containing desired focus * window; should be embedded. */ int force) /* One means that the container should claim * the focus if it doesn't currently have * it. */ { XEvent event; Container *containerPtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!(topLevelPtr->flags & TK_EMBEDDED)) { return; } for (containerPtr = tsdPtr->firstContainerPtr; containerPtr->embeddedPtr != topLevelPtr; containerPtr = containerPtr->nextPtr) { /* Empty loop body. */ } event.xfocus.type = FocusIn; event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display); event.xfocus.send_event = 1; event.xfocus.display = topLevelPtr->display; event.xfocus.window = containerPtr->parent; event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS; event.xfocus.detail = force; XSendEvent(event.xfocus.display, event.xfocus.window, False, 0, &event); }
void FinishX(Display* aDisplay) { unsigned long lastRequest = NextRequest(aDisplay) - 1; if (lastRequest == LastKnownRequestProcessed(aDisplay)) return; XSync(aDisplay, False); }
static void EmbedWindowDeleted( TkWindow *winPtr) /* Tk's information about window that * was deleted. */ { Container *containerPtr, *prevPtr; /* * Find the Container structure for this window. Delete the information * about the embedded application and free the container's record. */ prevPtr = NULL; containerPtr = firstContainerPtr; while (1) { if (containerPtr->embeddedPtr == winPtr) { /* * We also have to destroy our parent, to clean up the container. * Fabricate an event to do this. */ if (containerPtr->parentPtr != NULL && containerPtr->parentPtr->flags & TK_BOTH_HALVES) { XEvent event; event.xany.serial = LastKnownRequestProcessed(Tk_Display(containerPtr->parentPtr)); event.xany.send_event = False; event.xany.display = Tk_Display(containerPtr->parentPtr); event.xany.type = DestroyNotify; event.xany.window = containerPtr->parent; event.xdestroywindow.event = containerPtr->parent; Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD); } containerPtr->embedded = None; containerPtr->embeddedPtr = NULL; break; } if (containerPtr->parentPtr == winPtr) { containerPtr->parentPtr = NULL; break; } prevPtr = containerPtr; containerPtr = containerPtr->nextPtr; } if ((containerPtr->embeddedPtr == NULL) && (containerPtr->parentPtr == NULL)) { if (prevPtr == NULL) { firstContainerPtr = containerPtr->nextPtr; } else { prevPtr->nextPtr = containerPtr->nextPtr; } ckfree(containerPtr); } }
static int XhivIOError(Display *dpy) { fprintf(stderr, "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", errno, strerror (errno), DisplayString (dpy)); fprintf (stderr, " after %lu requests (%lu known processed) with %d events remaining.\r\n", NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), QLength(dpy)); abort(); }
/* Produce a client message to be sent by the caller */ static void DndFillClientMessage(Display * dpy, Window window, XClientMessageEvent *cm, DndData * dnd_data, char receiver) { DndMessage * dnd_message = (DndMessage*)&cm->data.b[0] ; cm->display = dpy; cm->type = ClientMessage; cm->serial = LastKnownRequestProcessed(dpy); cm->send_event = True; cm->window = window; cm->format = 8; cm->message_type = ATOM(_MOTIF_DRAG_AND_DROP_MESSAGE); dnd_message->reason = dnd_data->reason | DND_SET_EVENT_TYPE(receiver); dnd_message->byte_order = DndByteOrder(); /* we're filling in flags with more stuff that necessary, depending on the reason, but it doesn't matter */ dnd_message->flags = 0 ; dnd_message->flags |= DND_SET_STATUS(dnd_data->status) ; dnd_message->flags |= DND_SET_OPERATION(dnd_data->operation) ; dnd_message->flags |= DND_SET_OPERATIONS(dnd_data->operations) ; dnd_message->flags |= DND_SET_COMPLETION(dnd_data->completion) ; dnd_message->time = dnd_data->time ; switch(dnd_data->reason) { case DND_DROP_SITE_LEAVE: break ; case DND_TOP_LEVEL_ENTER: case DND_TOP_LEVEL_LEAVE: dnd_message->data.top.src_window = dnd_data->src_window ; dnd_message->data.top.property = dnd_data->property ; break ; /* cannot fall through since the byte layout is different in both set of messages, see top and pot union stuff */ case DND_DRAG_MOTION: case DND_OPERATION_CHANGED: case DND_DROP_SITE_ENTER: case DND_DROP_START: dnd_message->data.pot.x = dnd_data->x ; /* mouse position */ dnd_message->data.pot.y = dnd_data->y ; dnd_message->data.pot.src_window = dnd_data->src_window ; dnd_message->data.pot.property = dnd_data->property ; break ; default: break ; } }
static void NotifyVisibility( TkWindow *winPtr, XEvent *eventPtr) { if (winPtr->atts.event_mask & VisibilityChangeMask) { eventPtr->xany.serial = LastKnownRequestProcessed(winPtr->display); eventPtr->xvisibility.window = winPtr->window; Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL); } for (winPtr = winPtr->childList; winPtr != NULL; winPtr = winPtr->nextPtr) { if (winPtr->flags & TK_MAPPED) { NotifyVisibility(winPtr, eventPtr); } } }
void FakeFocusIn( Widget focus_widget, XtPointer client_data, XEvent *eventprm, Boolean *continue_to_dispatch ) { XEvent event; XEvent * eventPtr = &event; #ifdef VG_TRACE vg_TRACE_EXECUTION("main: entered FakeFocusIn ..."); #endif /* VG_TRACE */ /* * set the input focus to the login text widget... */ XSetInputFocus( XtDisplay(focus_widget), XtWindow(focus_widget), RevertToNone, CurrentTime); /* * create a synthetic focus-in event. * * Note: The above call to XSetInputFocus() was not originally included * in this routine. A bug fix to Motif made it necessary to add * the call. The synthetic focus-in event is probably now * unnecessary but is left in for caution's sake. (12/08/92) */ /* focus_widget = login_shell; */ eventPtr->type = FocusIn; eventPtr->xfocus.serial = LastKnownRequestProcessed(XtDisplay(focus_widget)); eventPtr->xfocus.send_event = True; eventPtr->xfocus.display = XtDisplay(focus_widget); eventPtr->xfocus.window = XtWindow(focus_widget); eventPtr->xfocus.mode = NotifyNormal; eventPtr->xfocus.detail = NotifyAncestor; XtDispatchEvent (eventPtr); ProcessTraversal(focus_widget, XmTRAVERSE_CURRENT); XtRemoveEventHandler(focus_widget, ExposureMask, FALSE, FakeFocusIn, NULL); }
void TkGenWMDestroyEvent( Tk_Window tkwin) { XEvent event; event.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); event.xany.send_event = False; event.xany.display = Tk_Display(tkwin); event.xclient.window = Tk_WindowId(tkwin); event.xclient.type = ClientMessage; event.xclient.message_type = Tk_InternAtom(tkwin, "WM_PROTOCOLS"); event.xclient.format = 32; event.xclient.data.l[0] = Tk_InternAtom(tkwin, "WM_DELETE_WINDOW"); Tk_HandleEvent(&event); }
bool QXcbGlxIntegration::handleXcbEvent(xcb_generic_event_t *event, uint responseType) { bool handled = false; // Check if a custom XEvent constructor was registered in xlib for this event type, and call it discarding the constructed XEvent if any. // XESetWireToEvent might be used by libraries to intercept messages from the X server e.g. the OpenGL lib waiting for DRI2 events. Display *xdisplay = static_cast<Display *>(m_connection->xlib_display()); XLockDisplay(xdisplay); bool locked = true; Bool (*proc)(Display*, XEvent*, xEvent*) = XESetWireToEvent(xdisplay, responseType, 0); if (proc) { XESetWireToEvent(xdisplay, responseType, proc); XEvent dummy; event->sequence = LastKnownRequestProcessed(xdisplay); if (proc(xdisplay, &dummy, (xEvent*)event)) { #ifdef XCB_HAS_XCB_GLX // DRI2 clients don't receive GLXBufferSwapComplete events on the wire. // Instead the GLX event is synthesized from the DRI2BufferSwapComplete event // by DRI2WireToEvent(). For an application to be able to see the event // we have to convert it to an xcb_glx_buffer_swap_complete_event_t and // pass it to the native event filter. const uint swap_complete = m_glx_first_event + XCB_GLX_BUFFER_SWAP_COMPLETE; QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance(); if (dispatcher && uint(dummy.type) == swap_complete && responseType != swap_complete) { QGLXBufferSwapComplete *xev = reinterpret_cast<QGLXBufferSwapComplete *>(&dummy); xcb_glx_buffer_swap_complete_event_t ev; memset(&ev, 0, sizeof(xcb_glx_buffer_swap_complete_event_t)); ev.response_type = xev->type; ev.sequence = xev->serial; ev.event_type = xev->event_type; ev.drawable = xev->drawable; ev.ust_hi = xev->ust >> 32; ev.ust_lo = xev->ust & 0xffffffff; ev.msc_hi = xev->msc >> 32; ev.msc_lo = xev->msc & 0xffffffff; ev.sbc = xev->sbc & 0xffffffff; // Unlock the display before calling the native event filter XUnlockDisplay(xdisplay); locked = false; QByteArray genericEventFilterType = m_connection->nativeInterface()->genericEventFilterType(); long result = 0; handled = dispatcher->filterNativeEvent(genericEventFilterType, &ev, &result); } #endif } }
void OptionsUnmapCB( Widget wd, XtPointer client_data, XtPointer call_data ) { int i; Dimension width, height; Widget w; XEvent event; #ifdef VG_TRACE vg_TRACE_EXECUTION("main: entered OptionsUnmapCB ..."); #endif /* VG_TRACE */ /* * simulate an exposure event over the Options pushbutton to make sure * the pushbutton elevates. (there is a bug in the toolkit where this * doesn't always happen on some servers)... */ w = options_button; i = 0; XtSetArg(argt[i], XmNwidth, &width ); i++; XtSetArg(argt[i], XmNheight, &height ); i++; XtGetValues(w, argt, i); event.type = Expose; event.xexpose.serial = LastKnownRequestProcessed(XtDisplay(w)); event.xexpose.send_event = True; event.xexpose.display = XtDisplay(w); event.xexpose.window = XtWindow(w); event.xexpose.x = 0; event.xexpose.y = 0; event.xexpose.width = 1; /* one pixel seems to be good enough, */ event.xexpose.height = 1; /* but time will tell... */ #if 0 event.xexpose.width = ToPixel(matte, XmHORIZONTAL, (int)width ); event.xexpose.height = ToPixel(matte, XmVERTICAL, (int)height ); #endif event.xexpose.count = 0; XtDispatchEvent (&event); }
static void MovePointer2( TkWindow *sourcePtr, /* Window currently containing pointer (NULL * means it's not one managed by this * process). */ TkWindow *destPtr, /* Window that is to end up containing the * pointer (NULL means it's not one managed by * this process). */ int mode, /* Mode for enter/leave events, such as * NotifyNormal or NotifyUngrab. */ int leaveEvents, /* Non-zero means generate leave events for * the windows being left. Zero means don't * generate leave events. */ int enterEvents) /* Non-zero means generate enter events for * the windows being entered. Zero means don't * generate enter events. */ { XEvent event; Window dummy1, dummy2; int dummy3, dummy4; TkWindow *winPtr; winPtr = sourcePtr; if ((winPtr == NULL) || (winPtr->window == None)) { winPtr = destPtr; if ((winPtr == NULL) || (winPtr->window == None)) { return; } } event.xcrossing.serial = LastKnownRequestProcessed(winPtr->display); event.xcrossing.send_event = GENERATED_GRAB_EVENT_MAGIC; event.xcrossing.display = winPtr->display; event.xcrossing.root = RootWindow(winPtr->display, winPtr->screenNum); event.xcrossing.time = TkCurrentTime(winPtr->dispPtr); XQueryPointer(winPtr->display, winPtr->window, &dummy1, &dummy2, &event.xcrossing.x_root, &event.xcrossing.y_root, &dummy3, &dummy4, &event.xcrossing.state); event.xcrossing.mode = mode; event.xcrossing.focus = False; TkInOutEvents(&event, sourcePtr, destPtr, (leaveEvents) ? LeaveNotify : 0, (enterEvents) ? EnterNotify : 0, TCL_QUEUE_MARK); }
static int GenerateMouseWheelEvent(MouseEventData * medPtr) { Tk_Window tkwin, rootwin; TkDisplay *dispPtr; TkWindow *winPtr; XEvent xEvent; dispPtr = TkGetDisplayList(); rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window); if (rootwin == NULL) { tkwin = NULL; } else { tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h, medPtr->local.v, &xEvent.xbutton.x, &xEvent.xbutton.y); } /* * The following call will generate the appropiate X events and * adjust any state that Tk must remember. */ if (!tkwin) { tkwin = TkMacOSXGetCapture(); } if (!tkwin) { return false; } winPtr = (TkWindow *) tkwin; xEvent.type = MouseWheelEvent; xEvent.xkey.keycode = medPtr->delta; xEvent.xbutton.x_root = medPtr->global.h; xEvent.xbutton.y_root = medPtr->global.v; xEvent.xbutton.state = medPtr->state; xEvent.xany.serial = LastKnownRequestProcessed(winPtr->display); xEvent.xany.send_event = false; xEvent.xany.display = winPtr->display; xEvent.xany.window = Tk_WindowId(winPtr); Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); return true; }
static void EmbedFocusProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = clientData; Display *display; XEvent event; if (containerPtr->embeddedPtr != NULL) { display = Tk_Display(containerPtr->parentPtr); event.xfocus.serial = LastKnownRequestProcessed(display); event.xfocus.send_event = false; event.xfocus.display = display; event.xfocus.mode = NotifyNormal; event.xfocus.window = containerPtr->embedded; if (eventPtr->type == FocusIn) { /* * The focus just arrived at the container. Change the X focus to * move it to the embedded application, if there is one. Ignore X * errors that occur during this operation (it's possible that the * new focus window isn't mapped). */ event.xfocus.detail = NotifyNonlinear; event.xfocus.type = FocusIn; } else if (eventPtr->type == FocusOut) { /* * When the container gets a FocusOut event, it has to tell the * embedded app that it has lost the focus. */ event.xfocus.type = FocusOut; event.xfocus.detail = NotifyNonlinear; } Tk_QueueWindowEvent(&event, TCL_QUEUE_MARK); } }
static void EmbedSendConfigure( Container *containerPtr) /* Information about the embedding. */ { TkWindow *winPtr = containerPtr->parentPtr; XEvent event; event.xconfigure.type = ConfigureNotify; event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display); event.xconfigure.send_event = True; event.xconfigure.display = winPtr->display; event.xconfigure.event = containerPtr->wrapper; event.xconfigure.window = containerPtr->wrapper; event.xconfigure.x = 0; event.xconfigure.y = 0; event.xconfigure.width = winPtr->changes.width; event.xconfigure.height = winPtr->changes.height; event.xconfigure.above = None; event.xconfigure.override_redirect = False; /* * Note: when sending the event below, the ButtonPressMask causes the * event to be sent only to applications that have selected for * ButtonPress events, which should be just the embedded application. */ XSendEvent(winPtr->display, containerPtr->wrapper, False, 0, &event); /* * The following needs to be done if the embedded window is not in the * same application as the container window. */ if (containerPtr->embeddedPtr == NULL) { XMoveResizeWindow(winPtr->display, containerPtr->wrapper, 0, 0, (unsigned) winPtr->changes.width, (unsigned) winPtr->changes.height); } }
static void InitializeEvent( XEvent *eventPtr, /* Event structure to initialize. */ TkWindow *winPtr, /* Window to make event relative to. */ int type, /* Message type. */ int x, int y, /* Root coords of event. */ int state, /* State flags. */ int detail) /* Detail value. */ { eventPtr->type = type; eventPtr->xany.serial = LastKnownRequestProcessed(winPtr->display); eventPtr->xany.send_event = False; eventPtr->xany.display = winPtr->display; eventPtr->xcrossing.root = RootWindow(winPtr->display, winPtr->screenNum); eventPtr->xcrossing.time = TkpGetMS(); eventPtr->xcrossing.x_root = x; eventPtr->xcrossing.y_root = y; switch (type) { case EnterNotify: case LeaveNotify: eventPtr->xcrossing.mode = NotifyNormal; eventPtr->xcrossing.state = state; eventPtr->xcrossing.detail = detail; eventPtr->xcrossing.focus = False; break; case MotionNotify: eventPtr->xmotion.state = state; eventPtr->xmotion.is_hint = detail; break; case ButtonPress: case ButtonRelease: eventPtr->xbutton.state = state; eventPtr->xbutton.button = detail; break; } TkChangeEventWindow(eventPtr, winPtr); }
static int GenerateToolbarButtonEvent( MouseEventData *medPtr) { Tk_Window rootwin, tkwin = NULL; TkDisplay *dispPtr; TkWindow *winPtr; XVirtualEvent event; dispPtr = TkGetDisplayList(); rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window); if (rootwin) { tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h, medPtr->local.v, &event.x, &event.y); } if (!tkwin) { return true; } winPtr = (TkWindow *) tkwin; bzero(&event, sizeof(XVirtualEvent)); event.type = VirtualEvent; event.serial = LastKnownRequestProcessed(winPtr->display); event.send_event = false; event.display = winPtr->display; event.event = winPtr->window; event.root = XRootWindow(winPtr->display, 0); event.subwindow = None; event.time = TkpGetMS(); event.x_root = medPtr->global.h; event.y_root = medPtr->global.v; event.state = medPtr->state; event.same_screen = true; event.name = Tk_GetUid("ToolbarButton"); Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); return true; }
MODULE_SCOPE int TkMacOSXGenerateFocusEvent( TkWindow *winPtr, /* Root X window for event. */ int activeFlag) { XEvent event; /* * Don't send focus events to windows of class help or to windows with the * kWindowNoActivatesAttribute. */ if (winPtr->wmInfoPtr && (winPtr->wmInfoPtr->macClass == kHelpWindowClass || winPtr->wmInfoPtr->attributes & kWindowNoActivatesAttribute)) { return false; } /* * Generate FocusIn and FocusOut events. This event is only sent to the * toplevel window. */ if (activeFlag) { event.xany.type = FocusIn; } else { event.xany.type = FocusOut; } event.xany.serial = LastKnownRequestProcessed(Tk_Display(winPtr)); event.xany.send_event = False; event.xfocus.display = Tk_Display(winPtr); event.xfocus.window = winPtr->window; event.xfocus.mode = NotifyNormal; event.xfocus.detail = NotifyDetailNone; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); return true; }
unsigned long XLastKnownRequestProcessed(Display *dpy) { return (LastKnownRequestProcessed(dpy)); }
void TkGenWMConfigureEvent( Tk_Window tkwin, int x, int y, int width, int height, int flags) { XEvent event; WmInfo *wmPtr; TkWindow *winPtr = (TkWindow *) tkwin; if (tkwin == NULL) { return; } event.type = ConfigureNotify; event.xconfigure.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); event.xconfigure.send_event = False; event.xconfigure.display = Tk_Display(tkwin); event.xconfigure.event = Tk_WindowId(tkwin); event.xconfigure.window = Tk_WindowId(tkwin); event.xconfigure.border_width = winPtr->changes.border_width; event.xconfigure.override_redirect = winPtr->atts.override_redirect; if (winPtr->changes.stack_mode == Above) { event.xconfigure.above = winPtr->changes.sibling; } else { event.xconfigure.above = None; } if (!(flags & TK_LOCATION_CHANGED)) { x = Tk_X(tkwin); y = Tk_Y(tkwin); } if (!(flags & TK_SIZE_CHANGED)) { width = Tk_Width(tkwin); height = Tk_Height(tkwin); } event.xconfigure.x = x; event.xconfigure.y = y; event.xconfigure.width = width; event.xconfigure.height = height; if (flags & TK_MACOSX_HANDLE_EVENT_IMMEDIATELY) { Tk_HandleEvent(&event); } else { Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } /* * Update window manager information. */ if (Tk_IsTopLevel(winPtr)) { wmPtr = winPtr->wmInfoPtr; if (flags & TK_LOCATION_CHANGED) { wmPtr->x = x; wmPtr->y = y; wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y); } if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) && ((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) { if ((wmPtr->width == -1) && (width == winPtr->reqWidth)) { /* * Don't set external width, since the user didn't change it * from what the widgets asked for. */ } else if (wmPtr->gridWin != NULL) { wmPtr->width = wmPtr->reqGridWidth + (width - winPtr->reqWidth)/wmPtr->widthInc; if (wmPtr->width < 0) { wmPtr->width = 0; } } else { wmPtr->width = width; } if ((wmPtr->height == -1) && (height == winPtr->reqHeight)) { /* * Don't set external height, since the user didn't change it * from what the widgets asked for. */ } else if (wmPtr->gridWin != NULL) { wmPtr->height = wmPtr->reqGridHeight + (height - winPtr->reqHeight)/wmPtr->heightInc; if (wmPtr->height < 0) { wmPtr->height = 0; } } else { wmPtr->height = height; } wmPtr->configWidth = width; wmPtr->configHeight = height; } } /* * Now set up the changes structure. Under X we wait for the * ConfigureNotify to set these values. On the Mac we know imediatly that * this is what we want - so we just set them. However, we need to make * sure the windows clipping region is marked invalid so the change is * visible to the subwindow. */ winPtr->changes.x = x; winPtr->changes.y = y; winPtr->changes.width = width; winPtr->changes.height = height; TkMacOSXInvalClipRgns(tkwin); }