1 /* event.c- event loop and handling
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
33 #include <X11/Xutil.h>
35 #include <X11/extensions/shape.h>
41 #ifdef KEEP_XKB_LOCK_STATUS
42 #include <X11/XKBlib.h>
43 #endif /* KEEP_XKB_LOCK_STATUS */
45 #include "WindowMaker.h"
51 #include "application.h"
54 #include "workspace.h"
57 #include "properties.h"
67 /******** Global Variables **********/
68 extern XContext wWinContext
;
70 extern Cursor wCursor
[WCUR_LAST
];
72 extern WShortKey wKeyBindings
[WKBD_LAST
];
73 extern int wScreenCount
;
74 extern Time LastTimestamp
;
75 extern Time LastFocusChange
;
77 extern WPreferences wPreferences
;
79 #define MOD_MASK wPreferences.modifier_mask
81 extern Atom _XA_WM_COLORMAP_NOTIFY
;
83 extern Atom _XA_WM_CHANGE_STATE
;
84 extern Atom _XA_WM_DELETE_WINDOW
;
85 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
;
86 extern Atom _XA_WINDOWMAKER_WM_FUNCTION
;
87 extern Atom _XA_WINDOWMAKER_COMMAND
;
90 extern Atom _XA_DND_PROTOCOL
;
95 extern Bool wShapeSupported
;
96 extern int wShapeEventBase
;
99 #ifdef KEEP_XKB_LOCK_STATUS
100 extern int wXkbEventBase
;
104 extern char WDelayedActionSet
;
107 /************ Local stuff ***********/
110 static void saveTimestamp(XEvent
*event
);
111 static void handleColormapNotify();
112 static void handleMapNotify(), handleUnmapNotify();
113 static void handleButtonPress(), handleExpose();
114 static void handleDestroyNotify();
115 static void handleConfigureRequest();
116 static void handleMapRequest();
117 static void handlePropertyNotify();
118 static void handleEnterNotify();
119 static void handleLeaveNotify();
120 static void handleExtensions();
121 static void handleClientMessage();
122 static void handleKeyPress();
123 static void handleFocusIn();
124 static void handleMotionNotify();
125 static void handleVisibilityNotify();
129 static void handleShapeNotify();
132 /* called from the signal handler */
133 void NotifyDeadProcess(pid_t pid
, unsigned char status
);
135 /* real dead process handler */
136 static void handleDeadProcess(void *foo
);
139 typedef struct DeadProcesses
{
141 unsigned char exit_status
;
144 /* stack of dead processes */
145 static DeadProcesses deadProcesses
[MAX_DEAD_PROCESSES
];
146 static int deadProcessPtr
=0;
149 typedef struct DeathHandler
{
150 WDeathHandler
*callback
;
152 struct DeathHandler
*next
;
156 static DeathHandler
*deathHandler
=NULL
;
161 wAddDeathHandler(pid_t pid
, WDeathHandler
*callback
, void *cdata
)
163 DeathHandler
*handler
;
165 handler
= malloc(sizeof(DeathHandler
));
170 handler
->callback
= callback
;
171 handler
->client_data
= cdata
;
173 handler
->next
= deathHandler
;
175 deathHandler
= handler
;
183 wDeleteDeathHandler(WMagicNumber id
)
185 DeathHandler
*tmp
, *handler
=(DeathHandler
*)id
;
187 if (!handler
|| !deathHandler
)
192 deathHandler
= handler
->next
;
196 if (tmp
->next
==handler
) {
197 tmp
->next
=handler
->next
;
208 DispatchEvent(XEvent
*event
)
211 handleDeadProcess(NULL
);
213 if (WCHECK_STATE(WSTATE_NEED_EXIT
)) {
214 WCHANGE_STATE(WSTATE_EXITING
);
215 /* received SIGTERM */
217 * WMHandleEvent() can't be called from anything
218 * executed inside here, or we can get in a infinite
221 Shutdown(WSExitMode
);
223 } else if (WCHECK_STATE(WSTATE_NEED_RESTART
)) {
224 WCHANGE_STATE(WSTATE_RESTARTING
);
226 Shutdown(WSRestartPreparationMode
);
227 /* received SIGHUP */
231 /* for the case that all that is wanted to be dispatched is
236 saveTimestamp(event
);
237 switch (event
->type
) {
239 handleMapRequest(event
);
243 handleKeyPress(event
);
247 handleMotionNotify(event
);
250 case ConfigureRequest
:
251 handleConfigureRequest(event
);
255 handleDestroyNotify(event
);
259 handleMapNotify(event
);
263 handleUnmapNotify(event
);
267 handleButtonPress(event
);
275 handlePropertyNotify(event
);
279 handleEnterNotify(event
);
283 handleLeaveNotify(event
);
287 handleClientMessage(event
);
291 handleColormapNotify(event
);
295 if (event
->xmapping
.request
== MappingKeyboard
296 || event
->xmapping
.request
== MappingModifier
)
297 XRefreshKeyboardMapping(&event
->xmapping
);
301 handleFocusIn(event
);
304 case VisibilityNotify
:
305 handleVisibilityNotify(event
);
308 handleExtensions(event
);
315 *----------------------------------------------------------------------
317 * Processes X and internal events indefinitely.
323 * The LastTimestamp global variable is updated.
324 *----------------------------------------------------------------------
332 WMNextEvent(dpy
, &event
);
333 WMHandleEvent(&event
);
340 IsDoubleClick(WScreen
*scr
, XEvent
*event
)
342 if ((scr
->last_click_time
>0) &&
343 (event
->xbutton
.time
-scr
->last_click_time
<=wPreferences
.dblclick_time
)
344 && (event
->xbutton
.button
== scr
->last_click_button
)
345 && (event
->xbutton
.window
== scr
->last_click_window
)) {
347 scr
->flags
.next_click_is_not_double
= 1;
348 scr
->last_click_time
= 0;
349 scr
->last_click_window
= event
->xbutton
.window
;
358 NotifyDeadProcess(pid_t pid
, unsigned char status
)
360 if (deadProcessPtr
>=MAX_DEAD_PROCESSES
-1) {
361 wwarning("stack overflow: too many dead processes");
364 /* stack the process to be handled later,
365 * as this is called from the signal handler */
366 deadProcesses
[deadProcessPtr
].pid
= pid
;
367 deadProcesses
[deadProcessPtr
].exit_status
= status
;
373 handleDeadProcess(void *foo
)
378 for (i
=0; i
<deadProcessPtr
; i
++) {
379 wWindowDeleteSavedStatesForPID(deadProcesses
[i
].pid
);
387 /* get the pids on the queue and call handlers */
388 while (deadProcessPtr
>0) {
397 if (tmp
->pid
== deadProcesses
[deadProcessPtr
].pid
) {
398 (*tmp
->callback
)(tmp
->pid
,
399 deadProcesses
[deadProcessPtr
].exit_status
,
401 wDeleteDeathHandler(tmp
);
410 saveTimestamp(XEvent
*event
)
412 WScreen
*scr
= wScreenForWindow(event
->xany
.window
);
413 LastTimestamp
= CurrentTime
;
415 switch (event
->type
) {
418 LastTimestamp
= event
->xbutton
.time
;
422 LastTimestamp
= event
->xkey
.time
;
425 LastTimestamp
= event
->xmotion
.time
;
428 LastTimestamp
= event
->xproperty
.time
;
432 LastTimestamp
= event
->xcrossing
.time
;
435 LastTimestamp
= event
->xselectionclear
.time
;
437 case SelectionRequest
:
438 LastTimestamp
= event
->xselectionrequest
.time
;
440 case SelectionNotify
:
441 LastTimestamp
= event
->xselection
.time
;
443 wXDNDProcessSelection(event
);
451 handleExtensions(XEvent
*event
)
453 #ifdef KEEP_XKB_LOCK_STATUS
455 xkbevent
= (XkbEvent
*)event
;
456 #endif /*KEEP_XKB_LOCK_STATUS*/
458 if (wShapeSupported
&& event
->type
== (wShapeEventBase
+ShapeNotify
)) {
459 handleShapeNotify(event
);
462 #ifdef KEEP_XKB_LOCK_STATUS
463 if (wPreferences
.modelock
&& (xkbevent
->type
== wXkbEventBase
)){
464 handleXkbIndicatorStateNotify(event
);
466 #endif /*KEEP_XKB_LOCK_STATUS*/
471 handleMapRequest(XEvent
*ev
)
475 Window window
= ev
->xmaprequest
.window
;
478 printf("got map request for %x\n", (unsigned)window
);
481 if ((wwin
= wWindowFor(window
))) {
482 if (wwin
->flags
.shaded
) {
483 wUnshadeWindow(wwin
);
485 /* deiconify window */
486 if (wwin
->flags
.miniaturized
) {
487 wDeiconifyWindow(wwin
);
488 } else if (wwin
->flags
.hidden
) {
489 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
490 /* go to the last workspace that the user worked on the app */
491 #ifndef REDUCE_APPICONS
492 /* This severely breaks REDUCE_APPICONS. last_workspace is a neat
493 * concept but it needs to be reworked to handle REDUCE_APPICONS -cls
496 wWorkspaceChange(wwin
->screen_ptr
, wapp
->last_workspace
);
499 wUnhideApplication(wapp
, False
, False
);
504 scr
= wScreenForRootWindow(ev
->xmaprequest
.parent
);
506 wwin
= wManageWindow(scr
, window
);
509 * This is to let the Dock know that the application it launched
510 * has already been mapped (eg: it has finished launching).
511 * It is not necessary for normally docked apps, but is needed for
512 * apps that were forcedly docked (like with dockit).
514 if (scr
->last_dock
) {
515 if (wwin
&& wwin
->main_window
!=None
&& wwin
->main_window
!=window
)
516 wDockTrackWindowLaunch(scr
->last_dock
, wwin
->main_window
);
518 wDockTrackWindowLaunch(scr
->last_dock
, window
);
522 wClientSetState(wwin
, NormalState
, None
);
523 if (wwin
->flags
.maximized
) {
524 wMaximizeWindow(wwin
, wwin
->flags
.maximized
);
526 if (wwin
->flags
.shaded
) {
527 wwin
->flags
.shaded
= 0;
528 wwin
->flags
.skip_next_animation
= 1;
531 if (wwin
->flags
.miniaturized
) {
532 wwin
->flags
.miniaturized
= 0;
533 wwin
->flags
.skip_next_animation
= 1;
534 wIconifyWindow(wwin
);
536 if (wwin
->flags
.hidden
) {
537 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
539 wwin
->flags
.hidden
= 0;
540 wwin
->flags
.skip_next_animation
= 1;
542 wHideApplication(wapp
);
550 handleDestroyNotify(XEvent
*event
)
554 Window window
= event
->xdestroywindow
.window
;
557 puts("got destroy notify");
560 wwin
= wWindowFor(window
);
562 wUnmanageWindow(wwin
, False
, True
);
565 app
= wApplicationOf(window
);
567 if (window
== app
->main_window
) {
569 wwin
= app
->main_window_desc
->screen_ptr
->focused_window
;
571 if (wwin
->main_window
== window
) {
572 wwin
->main_window
= None
;
577 wApplicationDestroy(app
);
581 wKWMCheckDestroy(&event
->xdestroywindow
);
588 handleExpose(XEvent
*event
)
590 WObjDescriptor
*desc
;
597 while (XCheckTypedWindowEvent(dpy
, event
->xexpose
.window
, Expose
, &ev
));
599 if (XFindContext(dpy
, event
->xexpose
.window
, wWinContext
,
600 (XPointer
*)&desc
)==XCNOENT
) {
604 if (desc
->handle_expose
) {
605 (*desc
->handle_expose
)(desc
, event
);
612 handleButtonPress(XEvent
*event
)
614 WObjDescriptor
*desc
;
618 puts("got button press");
621 scr
= wScreenForRootWindow(event
->xbutton
.root
);
629 if (event
->xbutton
.window
==scr
->root_win
) {
631 if (event
->xbutton
.button
==wPreferences
.menu_button
) {
632 OpenRootMenu(scr
, event
->xbutton
.x_root
,
633 event
->xbutton
.y_root
, False
);
635 if (scr
->root_menu
) {
636 if (scr
->root_menu
->brother
->flags
.mapped
)
637 event
->xbutton
.window
= scr
->root_menu
->brother
->frame
->core
->window
;
639 event
->xbutton
.window
= scr
->root_menu
->frame
->core
->window
;
641 } else if (event
->xbutton
.button
==wPreferences
.windowl_button
) {
642 OpenSwitchMenu(scr
, event
->xbutton
.x_root
,
643 event
->xbutton
.y_root
, False
);
644 if (scr
->switch_menu
) {
645 if (scr
->switch_menu
->brother
->flags
.mapped
)
646 event
->xbutton
.window
= scr
->switch_menu
->brother
->frame
->core
->window
;
648 event
->xbutton
.window
= scr
->switch_menu
->frame
->core
->window
;
650 } else if (event
->xbutton
.button
==wPreferences
.select_button
) {
651 wUnselectWindows(scr
);
652 wSelectWindows(scr
, event
);
654 #ifdef MOUSE_WS_SWITCH
655 else if (event
->xbutton
.button
==Button5
) {
657 wWorkspaceRelativeChange(scr
, -1);
659 } else if (event
->xbutton
.button
==Button4
) {
661 wWorkspaceRelativeChange(scr
, 1);
664 #endif /* MOUSE_WS_SWITCH */
666 else if (wGNOMEProxyizeButtonEvent(scr
, event
))
672 if (XFindContext(dpy
, event
->xbutton
.subwindow
, wWinContext
,
673 (XPointer
*)&desc
)==XCNOENT
) {
674 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
675 (XPointer
*)&desc
)==XCNOENT
) {
680 if (desc
->handle_mousedown
!=NULL
) {
681 (*desc
->handle_mousedown
)(desc
, event
);
684 if (desc
->parent_type
== WCLASS_WINDOW
) {
687 if (event
->xbutton
.state
& MOD_MASK
) {
688 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
691 if (wPreferences
.focus_mode
== WKF_CLICK
) {
692 if (wPreferences
.ignore_focus_click
) {
693 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
695 XAllowEvents(dpy
, ReplayPointer
, CurrentTime
);
698 } else if (desc
->parent_type
== WCLASS_APPICON
699 || desc
->parent_type
== WCLASS_MINIWINDOW
700 || desc
->parent_type
== WCLASS_DOCK_ICON
) {
701 if (event
->xbutton
.state
& MOD_MASK
) {
703 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
708 /* save double-click information */
709 if (scr
->flags
.next_click_is_not_double
) {
710 scr
->flags
.next_click_is_not_double
= 0;
712 scr
->last_click_time
= event
->xbutton
.time
;
713 scr
->last_click_button
= event
->xbutton
.button
;
714 scr
->last_click_window
= event
->xbutton
.window
;
720 handleMapNotify(XEvent
*event
)
728 wwin
= wWindowFor(event
->xmap
.event
);
729 if (wwin
&& wwin
->client_win
== event
->xmap
.event
) {
730 if (wwin
->flags
.miniaturized
) {
731 wDeiconifyWindow(wwin
);
735 wClientSetState(wwin
, NormalState
, None
);
743 handleUnmapNotify(XEvent
*event
)
747 Bool withdraw
= False
;
753 /* only process windows with StructureNotify selected
754 * (ignore SubstructureNotify) */
755 wwin
= wWindowFor(event
->xunmap
.window
);
759 /* whether the event is a Withdrawal request */
760 if (event
->xunmap
.event
== wwin
->screen_ptr
->root_win
761 && event
->xunmap
.send_event
)
764 if (wwin
->client_win
!= event
->xunmap
.event
&& !withdraw
)
767 if (!wwin
->flags
.mapped
&& !withdraw
768 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
769 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
)
773 XUnmapWindow(dpy
, wwin
->frame
->core
->window
);
774 wwin
->flags
.mapped
= 0;
776 /* check if the window was destroyed */
777 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, DestroyNotify
,&ev
)) {
780 Bool reparented
= False
;
782 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, ReparentNotify
, &ev
))
785 /* withdraw window */
786 wwin
->flags
.mapped
= 0;
788 wClientSetState(wwin
, WithdrawnState
, None
);
790 /* if the window was reparented, do not reparent it back to the
792 wUnmanageWindow(wwin
, !reparented
, False
);
799 handleConfigureRequest(XEvent
*event
)
804 puts("got configure request");
806 if (!(wwin
=wWindowFor(event
->xconfigurerequest
.window
))) {
808 * Configure request for unmapped window
810 wClientConfigure(NULL
, &(event
->xconfigurerequest
));
812 wClientConfigure(wwin
, &(event
->xconfigurerequest
));
818 handlePropertyNotify(XEvent
*event
)
828 puts("got property notify");
830 if ((wwin
=wWindowFor(event
->xproperty
.window
))) {
831 if (!XGetGeometry(dpy
, wwin
->client_win
, &jr
, &ji
, &ji
,
832 &ju
, &ju
, &ju
, &ju
)) {
835 wClientCheckProperty(wwin
, &event
->xproperty
);
837 wapp
= wApplicationOf(event
->xproperty
.window
);
839 wClientCheckProperty(wapp
->main_window_desc
, &event
->xproperty
);
842 scr
= wScreenForWindow(event
->xproperty
.window
);
843 if (scr
&& scr
->root_win
== event
->xproperty
.window
) {
845 wKWMCheckRootHintChange(scr
, &event
->xproperty
);
852 handleClientMessage(XEvent
*event
)
855 WObjDescriptor
*desc
;
858 puts("got client message");
860 /* handle transition from Normal to Iconic state */
861 if (event
->xclient
.message_type
== _XA_WM_CHANGE_STATE
862 && event
->xclient
.format
== 32
863 && event
->xclient
.data
.l
[0] == IconicState
) {
865 wwin
= wWindowFor(event
->xclient
.window
);
867 if (!wwin
->flags
.miniaturized
)
868 wIconifyWindow(wwin
);
869 } else if (event
->xclient
.message_type
== _XA_WM_COLORMAP_NOTIFY
870 && event
->xclient
.format
== 32) {
871 WScreen
*scr
= wScreenSearchForRootWindow(event
->xclient
.window
);
876 if (event
->xclient
.data
.l
[1] == 1) { /* starting */
877 wColormapAllowClientInstallation(scr
, True
);
878 } else { /* stopping */
879 wColormapAllowClientInstallation(scr
, False
);
881 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_COMMAND
) {
883 wDefaultsCheckDomains("bla");
885 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_WM_FUNCTION
) {
888 wapp
= wApplicationOf(event
->xclient
.window
);
890 switch (event
->xclient
.data
.l
[0]) {
891 case WMFHideOtherApplications
:
892 wHideOtherApplications(wapp
->main_window_desc
);
896 case WMFHideApplication
:
897 wHideApplication(wapp
);
903 wwin
= wWindowFor(event
->xclient
.window
);
905 switch (event
->xclient
.data
.l
[0]) {
906 case WMFHideOtherApplications
:
907 wHideOtherApplications(wwin
);
910 case WMFHideApplication
:
911 wHideApplication(wApplicationOf(wwin
->main_window
));
917 } else if (wGNOMEProcessClientMessage(&event
->xclient
)) {
919 #endif /* GNOME_STUFF */
921 } else if (wKWMProcessClientMessage(&event
->xclient
)) {
923 #endif /* KWM_HINTS */
925 } else if (wXDNDProcessClientMessage(&event
->xclient
)) {
929 } else if (event
->xclient
.message_type
==_XA_DND_PROTOCOL
) {
930 WScreen
*scr
= wScreenForWindow(event
->xclient
.window
);
931 if (scr
&& wDockReceiveDNDDrop(scr
,event
))
932 goto redirect_message
;
933 #endif /* OFFIX_DND */
939 * Non-standard thing, but needed by OffiX DND.
940 * For when the icon frame gets a ClientMessage
941 * that should have gone to the icon_window.
943 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
944 (XPointer
*)&desc
)!=XCNOENT
) {
945 struct WIcon
*icon
=NULL
;
947 if (desc
->parent_type
== WCLASS_MINIWINDOW
) {
948 icon
= (WIcon
*)desc
->parent
;
949 } else if (desc
->parent_type
== WCLASS_DOCK_ICON
950 || desc
->parent_type
== WCLASS_APPICON
) {
951 icon
= ((WAppIcon
*)desc
->parent
)->icon
;
953 if (icon
&& (wwin
=icon
->owner
)) {
954 if (wwin
->client_win
!=event
->xclient
.window
) {
955 event
->xclient
.window
= wwin
->client_win
;
956 XSendEvent(dpy
, wwin
->client_win
, False
, NoEventMask
,
966 raiseWindow(WScreen
*scr
)
970 scr
->autoRaiseTimer
= NULL
;
972 wwin
= wWindowFor(scr
->autoRaiseWindow
);
976 if (!wwin
->flags
.destroyed
) {
977 wRaiseFrame(wwin
->frame
->core
);
978 /* this is needed or a race condition will occur */
985 handleEnterNotify(XEvent
*event
)
988 WObjDescriptor
*desc
= NULL
;
990 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
994 puts("got enter notify");
997 if (XCheckTypedWindowEvent(dpy
, event
->xcrossing
.window
, LeaveNotify
,
999 /* already left the window... */
1001 if (ev
.xcrossing
.mode
==event
->xcrossing
.mode
1002 && ev
.xcrossing
.detail
==event
->xcrossing
.detail
) {
1007 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1008 (XPointer
*)&desc
)!=XCNOENT
) {
1009 if(desc
->handle_enternotify
)
1010 (*desc
->handle_enternotify
)(desc
, event
);
1013 /* enter to window */
1014 wwin
= wWindowFor(event
->xcrossing
.window
);
1016 if (wPreferences
.focus_mode
==WKF_POINTER
1017 && event
->xcrossing
.window
==event
->xcrossing
.root
) {
1018 wSetFocusTo(scr
, NULL
);
1020 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1021 wColormapInstallForWindow(scr
, NULL
);
1023 if (scr
->autoRaiseTimer
1024 && event
->xcrossing
.root
==event
->xcrossing
.window
) {
1025 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1026 scr
->autoRaiseTimer
= NULL
;
1029 /* set auto raise timer even if in focus-follows-mouse mode
1030 * and the event is for the frame window, even if the window
1031 * has focus already. useful if you move the pointer from a focused
1032 * window to the root window and back pretty fast
1034 * set focus if in focus-follows-mouse mode and the event
1035 * is for the frame window and window doesn't have focus yet */
1036 if ((wPreferences
.focus_mode
==WKF_POINTER
1037 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1038 && wwin
->frame
->core
->window
==event
->xcrossing
.window
1039 && !scr
->flags
.doing_alt_tab
) {
1041 if (!wwin
->flags
.focused
&& !WFLAGP(wwin
, no_focusable
))
1042 wSetFocusTo(scr
, wwin
);
1044 if (scr
->autoRaiseTimer
)
1045 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1046 scr
->autoRaiseTimer
= NULL
;
1048 if (wPreferences
.raise_delay
&& !WFLAGP(wwin
, no_focusable
)) {
1049 scr
->autoRaiseWindow
= wwin
->frame
->core
->window
;
1051 = WMAddTimerHandler(wPreferences
.raise_delay
,
1052 (WMCallback
*)raiseWindow
, scr
);
1055 /* Install colormap for window, if the colormap installation mode
1056 * is colormap_follows_mouse */
1057 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1058 if (wwin
->client_win
==event
->xcrossing
.window
)
1059 wColormapInstallForWindow(scr
, wwin
);
1061 wColormapInstallForWindow(scr
, NULL
);
1065 /* a little kluge to hide the clip balloon */
1066 if (!wPreferences
.flags
.noclip
&& scr
->flags
.clip_balloon_mapped
) {
1068 XUnmapWindow(dpy
, scr
->clip_balloon
);
1069 scr
->flags
.clip_balloon_mapped
= 0;
1071 if (desc
->parent_type
!=WCLASS_DOCK_ICON
1072 || scr
->clip_icon
!= desc
->parent
) {
1073 XUnmapWindow(dpy
, scr
->clip_balloon
);
1074 scr
->flags
.clip_balloon_mapped
= 0;
1079 if (event
->xcrossing
.window
== event
->xcrossing
.root
1080 && event
->xcrossing
.detail
== NotifyNormal
1081 && event
->xcrossing
.detail
!= NotifyInferior
1082 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1084 wSetFocusTo(scr
, scr
->focused_window
);
1088 wBalloonEnteredObject(scr
, desc
);
1094 handleLeaveNotify(XEvent
*event
)
1096 WObjDescriptor
*desc
= NULL
;
1098 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1099 (XPointer
*)&desc
)!=XCNOENT
) {
1100 if(desc
->handle_leavenotify
)
1101 (*desc
->handle_leavenotify
)(desc
, event
);
1103 if (event
->xcrossing
.window
== event
->xcrossing
.root
1104 && event
->xcrossing
.mode
== NotifyNormal
1105 && event
->xcrossing
.detail
!= NotifyInferior
1106 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1108 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1110 wSetFocusTo(scr
, NULL
);
1117 handleShapeNotify(XEvent
*event
)
1119 XShapeEvent
*shev
= (XShapeEvent
*)event
;
1124 puts("got shape notify");
1127 while (XCheckTypedWindowEvent(dpy
, shev
->window
, event
->type
, &ev
)) {
1128 XShapeEvent
*sev
= (XShapeEvent
*)&ev
;
1130 if (sev
->kind
== ShapeBounding
) {
1131 if (sev
->shaped
== shev
->shaped
) {
1134 XPutBackEvent(dpy
, &ev
);
1140 wwin
= wWindowFor(shev
->window
);
1141 if (!wwin
|| shev
->kind
!= ShapeBounding
)
1144 if (!shev
->shaped
&& wwin
->flags
.shaped
) {
1146 wwin
->flags
.shaped
= 0;
1147 wWindowClearShape(wwin
);
1149 } else if (shev
->shaped
) {
1151 wwin
->flags
.shaped
= 1;
1152 wWindowSetShape(wwin
);
1157 #ifdef KEEP_XKB_LOCK_STATUS
1158 /* please help ]d if you know what to do */
1159 handleXkbIndicatorStateNotify(XEvent
*event
)
1163 XkbStateRec staterec
;
1166 for (i
=0; i
<wScreenCount
; i
++) {
1167 scr
= wScreenWithNumber(i
);
1168 wwin
= scr
->focused_window
;
1169 if (wwin
&& wwin
->flags
.focused
) {
1170 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1171 if (wwin
->frame
->languagemode
!= staterec
.group
) {
1172 wwin
->frame
->last_languagemode
= wwin
->frame
->languagemode
;
1173 wwin
->frame
->languagemode
= staterec
.group
;
1175 #ifdef XKB_BUTTON_HINT
1176 if (wwin
->frame
->titlebar
) {
1177 wFrameWindowPaint(wwin
->frame
);
1183 #endif /*KEEP_XKB_LOCK_STATUS*/
1186 handleColormapNotify(XEvent
*event
)
1190 Bool reinstall
= False
;
1192 wwin
= wWindowFor(event
->xcolormap
.window
);
1196 scr
= wwin
->screen_ptr
;
1200 if (event
->xcolormap
.new) {
1201 XWindowAttributes attr
;
1203 XGetWindowAttributes(dpy
, wwin
->client_win
, &attr
);
1205 if (wwin
== scr
->cmap_window
&& wwin
->cmap_window_no
== 0)
1206 scr
->current_colormap
= attr
.colormap
;
1209 } else if (event
->xcolormap
.state
== ColormapUninstalled
&&
1210 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1212 /* some bastard app (like XV) removed our colormap */
1214 * can't enforce or things like xscreensaver wont work
1217 } else if (event
->xcolormap
.state
== ColormapInstalled
&&
1218 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1220 /* someone has put our colormap back */
1224 } while (XCheckTypedEvent(dpy
, ColormapNotify
, event
)
1225 && ((wwin
= wWindowFor(event
->xcolormap
.window
)) || 1));
1227 if (reinstall
&& scr
->current_colormap
!=None
) {
1228 if (!scr
->flags
.colormap_stuff_blocked
)
1229 XInstallColormap(dpy
, scr
->current_colormap
);
1236 handleFocusIn(XEvent
*event
)
1241 * For applications that like stealing the focus.
1243 while (XCheckTypedEvent(dpy
, FocusIn
, event
));
1244 saveTimestamp(event
);
1245 if (event
->xfocus
.mode
== NotifyUngrab
1246 || event
->xfocus
.mode
== NotifyGrab
1247 || event
->xfocus
.detail
> NotifyNonlinearVirtual
) {
1251 wwin
= wWindowFor(event
->xfocus
.window
);
1252 if (wwin
&& !wwin
->flags
.focused
) {
1253 if (wwin
->flags
.mapped
)
1254 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1256 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1258 WScreen
*scr
= wScreenForWindow(event
->xfocus
.window
);
1260 wSetFocusTo(scr
, NULL
);
1266 windowUnderPointer(WScreen
*scr
)
1272 if (XQueryPointer(dpy
, scr
->root_win
, &bar
, &win
, &foo
, &foo
, &foo
, &foo
,
1274 return wWindowFor(win
);
1278 #ifdef WEENDOZE_CYCLE
1281 nextToFocusAfter(WWindow
*wwin
)
1283 WWindow
*tmp
= wwin
->prev
;
1286 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1294 /* start over from the beginning of the list */
1298 while (tmp
&& tmp
!= wwin
) {
1299 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1311 nextToFocusBefore(WWindow
*wwin
)
1313 WWindow
*tmp
= wwin
->next
;
1316 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1323 /* start over from the beginning of the list */
1328 while (tmp
&& tmp
!= wwin
) {
1329 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1340 doWindozeCycle(WWindow
*wwin
, XEvent
*event
, Bool next
)
1342 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1344 Bool openedSwitchMenu
= False
;
1345 WWindow
*newFocused
;
1346 WWindow
*oldFocused
;
1348 XModifierKeymap
*keymap
;
1354 keymap
= XGetModifierMapping(dpy
);
1357 XGrabKeyboard(dpy
, scr
->root_win
, False
, GrabModeAsync
, GrabModeAsync
,
1361 newFocused
= nextToFocusAfter(wwin
);
1363 newFocused
= nextToFocusBefore(wwin
);
1366 scr
->flags
.doing_alt_tab
= 1;
1368 wWindowFocus(newFocused
, scr
->focused_window
);
1369 oldFocused
= newFocused
;
1370 if (wPreferences
.circ_raise
)
1371 wRaiseFrame(newFocused
->frame
->core
);
1373 if (wPreferences
.popup_switchmenu
&&
1374 (!scr
->switch_menu
|| !scr
->switch_menu
->flags
.mapped
)) {
1376 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, False
);
1377 openedSwitchMenu
= True
;
1383 WMMaskEvent(dpy
,KeyPressMask
|KeyReleaseMask
|ExposureMask
, &ev
);
1384 /* WMNextEvent(dpy, &ev);*/
1385 if (ev
.type
!= KeyRelease
&& ev
.type
!= KeyPress
) {
1390 /* ignore CapsLock */
1391 modifiers
= ev
.xkey
.state
& ValidModMask
;
1393 if (ev
.type
== KeyPress
1394 && wKeyBindings
[WKBD_FOCUSNEXT
].keycode
== ev
.xkey
.keycode
1395 && wKeyBindings
[WKBD_FOCUSNEXT
].modifier
== modifiers
) {
1397 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1398 newFocused
= nextToFocusAfter(newFocused
);
1399 wWindowFocus(newFocused
, oldFocused
);
1400 oldFocused
= newFocused
;
1401 if (wPreferences
.circ_raise
)
1402 wRaiseFrame(newFocused
->frame
->core
);
1403 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1405 } else if (ev
.type
== KeyPress
1406 && wKeyBindings
[WKBD_FOCUSPREV
].keycode
== ev
.xkey
.keycode
1407 && wKeyBindings
[WKBD_FOCUSPREV
].modifier
== modifiers
) {
1409 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1410 newFocused
= nextToFocusBefore(newFocused
);
1411 wWindowFocus(newFocused
, oldFocused
);
1412 oldFocused
= newFocused
;
1413 if (wPreferences
.circ_raise
)
1414 wRaiseFrame(newFocused
->frame
->core
);
1415 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1417 if (ev
.type
== KeyRelease
) {
1420 for (i
= 0; i
<= 8 * keymap
->max_keypermod
; i
++) {
1421 if (keymap
->modifiermap
[i
] == ev
.xkey
.keycode
&&
1422 wKeyBindings
[WKBD_FOCUSNEXT
].modifier
1423 & 1<<(i
/keymap
->max_keypermod
)) {
1433 XUngrabKeyboard(dpy
, CurrentTime
);
1434 wSetFocusTo(scr
, newFocused
);
1435 scr
->flags
.doing_alt_tab
= 0;
1436 if (openedSwitchMenu
)
1437 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, False
);
1441 #endif /* WEENDOZE_CYCLE */
1447 handleKeyPress(XEvent
*event
)
1449 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1450 WWindow
*wwin
= scr
->focused_window
;
1454 #ifdef KEEP_XKB_LOCK_STATUS
1455 XkbStateRec staterec
;
1456 #endif /*KEEP_XKB_LOCK_STATUS*/
1458 /* ignore CapsLock */
1459 modifiers
= event
->xkey
.state
& ValidModMask
;
1461 for (i
=0; i
<WKBD_LAST
; i
++) {
1462 if (wKeyBindings
[i
].keycode
==0)
1465 if (wKeyBindings
[i
].keycode
==event
->xkey
.keycode
1466 && (/*wKeyBindings[i].modifier==0
1467 ||*/ wKeyBindings
[i
].modifier
==modifiers
)) {
1480 if (!wRootMenuPerformShortcut(event
)) {
1482 static int dontLoop
= 0;
1484 if (dontLoop
> 10) {
1485 wwarning("problem with key event processing code");
1489 /* if the focused window is an internal window, try redispatching
1490 * the event to the managed window, as it can be a WINGs window */
1491 if (wwin
&& wwin
->flags
.internal_window
1492 && wwin
->client_leader
!=None
) {
1493 /* client_leader contains the WINGs toplevel */
1494 event
->xany
.window
= wwin
->client_leader
;
1495 WMHandleEvent(event
);
1502 #define ISMAPPED(w) ((w) && !(w)->flags.miniaturized && ((w)->flags.mapped || (w)->flags.shaded))
1503 #define ISFOCUSED(w) ((w) && (w)->flags.focused)
1508 OpenRootMenu(scr
, event
->xkey
.x_root
, event
->xkey
.y_root
, True
);
1510 case WKBD_WINDOWLIST
:
1511 OpenSwitchMenu(scr
, event
->xkey
.x_root
, event
->xkey
.y_root
, True
);
1514 case WKBD_WINDOWMENU
:
1515 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
))
1516 OpenWindowMenu(wwin
, wwin
->frame_x
,
1517 wwin
->frame_y
+wwin
->frame
->top_width
, True
);
1519 case WKBD_MINIATURIZE
:
1520 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)
1521 && !WFLAGP(wwin
, no_miniaturizable
)) {
1522 CloseWindowMenu(scr
);
1524 if (wwin
->protocols
.MINIATURIZE_WINDOW
)
1525 wClientSendProtocol(wwin
, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
,
1526 event
->xbutton
.time
);
1528 wIconifyWindow(wwin
);
1533 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1534 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1535 CloseWindowMenu(scr
);
1537 if (wapp
&& !WFLAGP(wapp
->main_window_desc
, no_appicon
)) {
1538 wHideApplication(wapp
);
1543 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1544 CloseWindowMenu(scr
);
1546 if (wwin
->flags
.maximized
) {
1547 wUnmaximizeWindow(wwin
);
1549 wMaximizeWindow(wwin
, MAX_VERTICAL
|MAX_HORIZONTAL
);
1553 case WKBD_VMAXIMIZE
:
1554 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1555 CloseWindowMenu(scr
);
1557 if (wwin
->flags
.maximized
) {
1558 wUnmaximizeWindow(wwin
);
1560 wMaximizeWindow(wwin
, MAX_VERTICAL
);
1565 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1566 CloseWindowMenu(scr
);
1568 wRaiseFrame(wwin
->frame
->core
);
1572 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1573 CloseWindowMenu(scr
);
1575 wLowerFrame(wwin
->frame
->core
);
1578 case WKBD_RAISELOWER
:
1579 /* raise or lower the window under the pointer, not the
1582 wwin
= windowUnderPointer(scr
);
1584 wRaiseLowerFrame(wwin
->frame
->core
);
1587 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_shadeable
)) {
1588 if (wwin
->flags
.shaded
)
1589 wUnshadeWindow(wwin
);
1594 case WKBD_MOVERESIZE
:
1595 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1596 CloseWindowMenu(scr
);
1598 wKeyboardMoveResizeWindow(wwin
);
1602 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_closable
)) {
1603 CloseWindowMenu(scr
);
1604 if (wwin
->protocols
.DELETE_WINDOW
)
1605 wClientSendProtocol(wwin
, _XA_WM_DELETE_WINDOW
,
1610 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1611 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1614 case WKBD_FOCUSNEXT
:
1615 #ifdef WEENDOZE_CYCLE
1616 if (wPreferences
.windoze_cycling
) {
1617 doWindozeCycle(wwin
, event
, True
);
1619 #endif /* WEENDOZE_CYCLE */
1621 wwin
= NextFocusWindow(scr
);
1623 wSetFocusTo(scr
, wwin
);
1624 if (wPreferences
.circ_raise
)
1625 wRaiseFrame(wwin
->frame
->core
);
1630 case WKBD_FOCUSPREV
:
1631 #ifdef WEENDOZE_CYCLE
1632 if (wPreferences
.windoze_cycling
) {
1633 doWindozeCycle(wwin
, event
, False
);
1635 #endif /* WEENDOZE_CYCLE */
1637 wwin
= PrevFocusWindow(scr
);
1639 wSetFocusTo(scr
, wwin
);
1640 if (wPreferences
.circ_raise
)
1641 wRaiseFrame(wwin
->frame
->core
);
1646 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
1647 #define GOTOWORKS(wk) case WKBD_WORKSPACE##wk:\
1648 i = (scr->current_workspace/10)*10 + wk - 1;\
1649 if (wPreferences.ws_advance || i<scr->workspace_count)\
1650 wWorkspaceChange(scr, i);\
1653 #define GOTOWORKS(wk) case WKBD_WORKSPACE/**/wk:\
1654 i = (scr->current_workspace/10)*10 + wk - 1;\
1655 if (wPreferences.ws_advance || i<scr->workspace_count)\
1656 wWorkspaceChange(scr, i);\
1670 case WKBD_NEXTWORKSPACE
:
1671 wWorkspaceRelativeChange(scr
, 1);
1673 case WKBD_PREVWORKSPACE
:
1674 wWorkspaceRelativeChange(scr
, -1);
1680 #ifdef EXTEND_WINDOWSHORTCUT
1688 if ( scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]) {
1689 LinkedList
*list
= scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
];
1692 wUnselectWindows(scr
);
1693 if (scr
->shortcutWindow
[command
-WKBD_WINDOW1
])
1694 wMakeWindowVisible(scr
->shortcutWindow
[command
-WKBD_WINDOW1
]);
1695 cw
= scr
->current_workspace
;
1697 wWindowChangeWorkspace(list
->head
, cw
);
1698 wMakeWindowVisible(list
->head
);
1699 wSelectWindow(list
->head
, True
);
1702 } else if (scr
->shortcutWindow
[command
-WKBD_WINDOW1
]){
1704 wMakeWindowVisible(scr
->shortcutWindow
[command
-WKBD_WINDOW1
]);
1706 } else if (wwin
&& ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1708 scr
->shortcutWindow
[command
-WKBD_WINDOW1
] = wwin
;
1709 if (wwin
->flags
.selected
/* && scr->selected_windows */ ) {
1712 sl
= scr
->selected_windows
;
1713 list_free(scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1716 scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
] = list_cons(sl
->head
,scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1720 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1723 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1726 } else if (scr
->selected_windows
) {
1728 if (wwin
->flags
.selected
/* && scr->selected_windows */ ) {
1731 sl
= scr
->selected_windows
;
1732 list_free(scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1735 scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
] = list_cons(sl
->head
,scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1742 case WKBD_NEXTWSLAYER
:
1743 case WKBD_PREVWSLAYER
:
1747 row
= scr
->current_workspace
/10;
1748 column
= scr
->current_workspace
%10;
1750 if (command
==WKBD_NEXTWSLAYER
) {
1751 if ((row
+1)*10 < scr
->workspace_count
)
1752 wWorkspaceChange(scr
, column
+(row
+1)*10);
1755 wWorkspaceChange(scr
, column
+(row
-1)*10);
1759 case WKBD_CLIPLOWER
:
1760 if (!wPreferences
.flags
.noclip
)
1761 wDockLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1763 case WKBD_CLIPRAISE
:
1764 if (!wPreferences
.flags
.noclip
)
1765 wDockRaise(scr
->workspaces
[scr
->current_workspace
]->clip
);
1767 case WKBD_CLIPRAISELOWER
:
1768 if (!wPreferences
.flags
.noclip
)
1769 wDockRaiseLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1771 #ifdef KEEP_XKB_LOCK_STATUS
1773 if(wPreferences
.modelock
) {
1775 wwin
= scr
->focused_window
;
1777 if (wwin
&& wwin
->flags
.mapped
1778 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
1779 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
) {
1780 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1782 wwin
->frame
->languagemode
= wwin
->frame
->last_languagemode
;
1783 wwin
->frame
->last_languagemode
= staterec
.group
;
1784 XkbLockGroup(dpy
,XkbUseCoreKbd
, wwin
->frame
->languagemode
);
1789 #endif /* KEEP_XKB_LOCK_STATUS */
1796 handleMotionNotify(XEvent
*event
)
1799 WScreen
*scr
= wScreenForRootWindow(event
->xmotion
.root
);
1801 if (wPreferences
.scrollable_menus
) {
1802 if (scr
->flags
.jump_back_pending
||
1803 event
->xmotion
.x_root
<= 1 ||
1804 event
->xmotion
.x_root
>= (scr
->scr_width
- 2) ||
1805 event
->xmotion
.y_root
<= 1 ||
1806 event
->xmotion
.y_root
>= (scr
->scr_height
- 2)) {
1809 puts("pointer at screen edge");
1812 menu
= wMenuUnderPointer(scr
);
1814 wMenuScroll(menu
, event
);
1818 if (event
->xmotion
.subwindow
== None
)
1821 if (scr
->scrolledFMaximize
!= None
) {
1824 twin
= wWindowFor(scr
->scrolledFMaximize
);
1825 if (twin
&& twin
->frame_y
==) {
1829 scr
->scrolledFMaximize
= NULL
;
1833 /* scroll full maximized window */
1834 if (event
->xmotion
.y_root
< 1
1835 || event
->xmotion
.y_root
> scr
->scr_height
- 1) {
1837 wwin
= wWindowFor(event
->xmotion
.subwindow
);
1839 if (wwin
&& (wwin
->flags
.maximized
& MAX_VERTICAL
)
1840 && WFLAGP(wwin
, full_maximize
)
1841 && event
->xmotion
.x_root
>= wwin
->frame_x
1842 && event
->xmotion
.x_root
<= wwin
->frame_x
+ wwin
->frame
->core
->width
) {
1844 if (!WFLAGP(wwin
, no_titlebar
)
1845 && wwin
->frame_y
<= - wwin
->frame
->top_width
) {
1847 wWindowMove(wwin
, wwin
->frame_x
, 0);
1848 wwin
->flags
.dragged_while_fmaximized
= 0;
1850 } else if (!WFLAGP(wwin
, no_resizebar
)
1851 && wwin
->frame_y
+ wwin
->frame
->core
->height
>=
1852 scr
->scr_height
+ wwin
->frame
->bottom_width
) {
1854 int y
= scr
->scr_height
+ wwin
->frame
->bottom_width
;
1856 y
= scr
->scr_height
- wwin
->frame_y
- wwin
->frame
->core
->height
;
1858 wWindowMove(wwin
, wwin
->frame_x
, y
);
1859 wwin
->flags
.dragged_while_fmaximized
= 0;
1868 handleVisibilityNotify(XEvent
*event
)
1872 wwin
= wWindowFor(event
->xvisibility
.window
);
1875 wwin
->flags
.obscured
=
1876 (event
->xvisibility
.state
== VisibilityFullyObscured
);