/** Handle a button release on a tray. */ void HandleTrayButtonRelease(TrayType *tp, const XButtonEvent *event) { TrayComponentType *cp; // First inform any components that have a grab. for(cp = tp->components; cp; cp = cp->next) { if(cp->grabbed) { const int x = event->x - cp->x; const int y = event->y - cp->y; const int mask = event->button; (cp->ProcessButtonRelease)(cp, x, y, mask); JXUngrabPointer(display, CurrentTime); cp->grabbed = 0; return; } } cp = GetTrayComponent(tp, event->x, event->y); if(cp && cp->ProcessButtonRelease) { const int x = event->x - cp->x; const int y = event->y - cp->y; const int mask = event->button; (cp->ProcessButtonRelease)(cp, x, y, mask); } }
/** Select a window for performing an action. */ void ChooseWindow(const MenuAction *action) { XEvent event; ClientNode *np; GrabMouseForChoose(); for(;;) { WaitForEvent(&event); if(event.type == ButtonPress) { if(event.xbutton.button == Button1) { np = FindClient(event.xbutton.subwindow); if(np) { client = np; RunWindowCommand(action); } } break; } else if(event.type == KeyPress) { break; } } JXUngrabPointer(display, CurrentTime); }
/** Callback to stop a resize. */ void ResizeController(int wasDestroyed) { if(resizeMode == RESIZE_OUTLINE) { ClearOutline(); } JXUngrabPointer(display, CurrentTime); JXUngrabKeyboard(display, CurrentTime); DestroyResizeWindow(); shouldStopResize = 1; }
/** Callback for stopping moves. */ void MoveController(int wasDestroyed) { if(settings.moveMode == MOVE_OUTLINE) { ClearOutline(); } JXUngrabPointer(display, CurrentTime); JXUngrabKeyboard(display, CurrentTime); DestroyMoveWindow(); shouldStopMove = 1; atTop = 0; atBottom = 0; atLeft = 0; atRight = 0; }