15#include "ctwm_atoms.h"
19#include "functions_defs.h"
43 tmp_win->auto_raise = !tmp_win->auto_raise;
44 if(tmp_win->auto_raise) {
45 ++(
Scr->NumAutoRaises);
48 --(
Scr->NumAutoRaises);
54 tmp_win->auto_lower = !tmp_win->auto_lower;
55 if(tmp_win->auto_lower) {
56 ++(
Scr->NumAutoLowers);
59 --(
Scr->NumAutoLowers);
79 if(tmp_win->icon && (w == tmp_win->icon->w) &&
Context !=
C_ROOT) {
108 if(tmp_win->icon && (w == tmp_win->icon->w)) {
120 if(tmp_win->icon && w == tmp_win->icon->w) {
137 if(tmp_win->icon && (w == tmp_win->icon->w) &&
Context !=
C_ROOT) {
149 if(tmp_win->icon && (w == tmp_win->icon->w) &&
Context !=
C_ROOT) {
185 if(tmp_win->isicon) {
188 else if(func == F_ICONIFY) {
189 Iconify(tmp_win, eventp->xbutton.x_root - 5,
190 eventp->xbutton.y_root - 5);
220 if(
Scr->WindowFunction.func != 0) {
222 Scr->WindowFunction.item->action,
223 w, tmp_win, eventp,
C_FRAME,
false);
243 if(!tmp_win->isicon) {
244 if(!
Scr->FocusRoot &&
Scr->Focus == tmp_win) {
249 SetFocus(tmp_win, eventp->xbutton.time);
250 Scr->FocusRoot =
false;
278 if(tmp_win->isiconmgr) {
286 || (
Scr->workSpaceMgr.occupyWindow
287 && tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win)) {
296 XMaskEvent(
dpy, ButtonReleaseMask, &kev);
297 if(kev.xbutton.window == tmp_win->w) {
298 kev.xbutton.window =
Scr->Root;
300 XPutBackEvent(
dpy, &kev);
309 if(tmp_win->isiconmgr || tmp_win->iswspmgr
313 || (
Scr->workSpaceMgr.occupyWindow
314 && tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win)) {
318 XKillClient(
dpy, tmp_win->w);
322 XMaskEvent(
dpy, ButtonReleaseMask, &kev);
323 if(kev.xbutton.window == tmp_win->w) {
324 kev.xbutton.window =
Scr->Root;
326 XPutBackEvent(
dpy, &kev);
332 if(tmp_win->isiconmgr) {
340 || (
Scr->workSpaceMgr.occupyWindow
341 && tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win)) {
349 XKillClient(
dpy, tmp_win->w);
354 XMaskEvent(
dpy, ButtonReleaseMask, &kev);
355 if(kev.xbutton.window == tmp_win->w) {
356 kev.xbutton.window =
Scr->Root;
358 XPutBackEvent(
dpy, &kev);
379 if(tmp_win->icon && w == tmp_win->icon->w) {
386 case F_PRIORITYSWITCHING:
390 pri = (int)strtol(action, &endp, 10);
392 (*endp ==
'<' || *endp ==
'b') ? Below : Above);
394 case F_CHANGEPRIORITY:
397 case F_SWITCHPRIORITY:
471 XSetWindowAttributes attributes;
472 unsigned long valuemask;
474 valuemask = CWBackPixel;
475 attributes.background_pixel =
Scr->Black;
476 w = XCreateWindow(
dpy,
Scr->Root, 0, 0,
480 CopyFromParent, CopyFromParent,
481 CopyFromParent, valuemask,
484 XDestroyWindow(
dpy, w);
491 if(context ==
C_ICON && tmp_win->icon && tmp_win->icon->w)
492 w = XCreateSimpleWindow(
dpy, tmp_win->icon->w,
493 0, 0, 9999, 9999, 0,
Scr->Black,
Scr->Black);
495 w = XCreateSimpleWindow(
dpy, tmp_win->frame,
496 0, 0, 9999, 9999, 0,
Scr->Black,
Scr->Black);
499 XDestroyWindow(
dpy, w);
520 if(tmp_win->squeezed) {
530 int deltax = 0, newx = 0;
536 if(tmp_win->squeezed ||
537 !tmp_win->squeeze_info ||
545 if(!tmp_win->squeeze_info_copied) {
550 *s = *tmp_win->squeeze_info;
551 tmp_win->squeeze_info = s;
552 tmp_win->squeeze_info_copied =
true;
554 si = tmp_win->squeeze_info;
557 int target_denom = tmp_win->frame_width;
565 if(si->
denom != target_denom) {
566 float scale = (float)target_denom / si->
denom;
568 si->
denom = target_denom;
574 if(tmp_win->winbox) {
575 XTranslateCoordinates(
dpy,
Scr->Root, tmp_win->winbox->window,
576 eventp->xbutton.x_root, eventp->xbutton.y_root,
577 &eventp->xbutton.x_root, &eventp->xbutton.y_root, &
JunkChild);
602 rootw = eventp->xbutton.root;
607 if(!
Scr->NoGrabServer) {
613 if(tmp_win->winbox) {
614 grabwin = tmp_win->winbox->window;
617 XGrabPointer(
dpy, grabwin, True,
618 ButtonPressMask | ButtonReleaseMask |
619 ButtonMotionMask | PointerMotionMask,
620 GrabModeAsync, GrabModeAsync, grabwin,
Scr->MoveCursor, CurrentTime);
623 if(! tmp_win->icon || w != tmp_win->icon->w) {
624 XTranslateCoordinates(
dpy, w, tmp_win->frame,
639 origX = eventp->xbutton.x_root;
644 XWarpPointer(
dpy, None,
Scr->Root, 0, 0, 0, 0,
652 ButtonPress : ButtonRelease;
654 PointerMotionMask : ButtonMotionMask;
657 XMaskEvent(
dpy, ButtonPressMask | ButtonReleaseMask |
658 EnterWindowMask | LeaveWindowMask |
659 ExposureMask | movementMask |
660 VisibilityChangeMask, &
Event);
663 if(
Event.xany.type == EnterNotify ||
664 Event.xany.type == LeaveNotify) {
668 if(
Event.type == MotionNotify) {
670 while(XCheckMaskEvent(
dpy,
671 movementMask | releaseEvent, &
Event)) {
672 if(
Event.type == releaseEvent) {
682 if(
Event.type == releaseEvent) {
687 if(
Event.type != MotionNotify) {
692 XQueryPointer(
dpy, rootw, &eventp->xmotion.root, &
JunkChild,
693 &eventp->xmotion.x_root, &eventp->xmotion.y_root,
698 if(tmp_win->winbox) {
699 XTranslateCoordinates(
dpy,
Scr->Root, tmp_win->winbox->window,
700 eventp->xmotion.x_root, eventp->xmotion.y_root,
701 &eventp->xmotion.x_root, &eventp->xmotion.y_root, &
JunkChild);
709 deltax = eventp->xmotion.x_root - origX;
710 newx = origNum + deltax;
720 int wtmp = tmp_win->frame_width;
725 else if(newx < -wtmp) {
729 else if(origNum >= 0) {
733 else if(newx >= wtmp) {
bool InstallWindowColormaps(int type, TwmWindow *tmp)
void BumpWindowColormap(TwmWindow *tmp, int inc)
#define DoesWmDeleteWindow
#define DoesWmSaveYourself
bool DispatchEvent2(void)
event_proc EventHandler[256]
void FixRootEvent(XEvent *e)
void EwmhSet_NET_WM_STATE(TwmWindow *twm_win, int changes)
void ExecuteFunction(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
void HideIconManager(void)
static void raise_handler(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
static void iconify_handler(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
static void otp_priority_handler(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
static void SendDeleteWindowMessage(TwmWindow *tmp, Time timestamp)
void OtpChangePriority(TwmWindow *twm_win, WinType wintype, int relpriority)
void OtpTinyLower(TwmWindow *twm_win, WinType wintype)
void OtpTinyRaise(TwmWindow *twm_win, WinType wintype)
void OtpStashAflagsFirstTime(TwmWindow *twm_win)
void OtpLower(TwmWindow *twm_win, WinType wintype)
void OtpToggleSwitching(TwmWindow *twm_win, WinType wintype)
void OtpSetPriority(TwmWindow *twm_win, WinType wintype, int new_pri, int where)
void OtpCirculateSubwindows(VirtualScreen *vs, int direction)
void OtpSwitchPriority(TwmWindow *twm_win, WinType wintype)
void OtpRaise(TwmWindow *twm_win, WinType wintype)
void OtpRaiseLower(TwmWindow *twm_win, WinType wintype)
Info and control for every X Window we take over.
Window w
The actual X Window handle.
void SetFrameShape(TwmWindow *tmp)
void Iconify(TwmWindow *tmp_win, int def_x, int def_y)
void DeIconify(TwmWindow *tmp_win)
void Squeeze(TwmWindow *tmp_win)
void SetFocus(TwmWindow *tmp_win, Time tim)
void send_clientmessage(Window w, Atom a, Time timestamp)
void WMapLower(TwmWindow *win)
void WMapRaiseLower(TwmWindow *win)
void WMapRaise(TwmWindow *win)