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 LastTimestamp
= CurrentTime
;
414 switch (event
->type
) {
417 LastTimestamp
= event
->xbutton
.time
;
421 LastTimestamp
= event
->xkey
.time
;
424 LastTimestamp
= event
->xmotion
.time
;
427 LastTimestamp
= event
->xproperty
.time
;
431 LastTimestamp
= event
->xcrossing
.time
;
434 LastTimestamp
= event
->xselectionclear
.time
;
436 case SelectionRequest
:
437 LastTimestamp
= event
->xselectionrequest
.time
;
439 case SelectionNotify
:
440 LastTimestamp
= event
->xselection
.time
;
442 wXDNDProcessSelection(event
);
450 handleExtensions(XEvent
*event
)
452 #ifdef KEEP_XKB_LOCK_STATUS
454 xkbevent
= (XkbEvent
*)event
;
455 #endif /*KEEP_XKB_LOCK_STATUS*/
457 if (wShapeSupported
&& event
->type
== (wShapeEventBase
+ShapeNotify
)) {
458 handleShapeNotify(event
);
461 #ifdef KEEP_XKB_LOCK_STATUS
462 if (wPreferences
.modelock
&& (xkbevent
->type
== wXkbEventBase
)){
463 handleXkbIndicatorStateNotify(event
);
465 #endif /*KEEP_XKB_LOCK_STATUS*/
470 handleMapRequest(XEvent
*ev
)
474 Window window
= ev
->xmaprequest
.window
;
477 printf("got map request for %x\n", (unsigned)window
);
480 if ((wwin
= wWindowFor(window
))) {
481 if (wwin
->flags
.shaded
) {
482 wUnshadeWindow(wwin
);
484 /* deiconify window */
485 if (wwin
->flags
.miniaturized
) {
486 wDeiconifyWindow(wwin
);
487 } else if (wwin
->flags
.hidden
) {
488 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
489 /* go to the last workspace that the user worked on the app */
490 #ifndef REDUCE_APPICONS
491 /* This severely breaks REDUCE_APPICONS. last_workspace is a neat
492 * concept but it needs to be reworked to handle REDUCE_APPICONS -cls
495 wWorkspaceChange(wwin
->screen_ptr
, wapp
->last_workspace
);
498 wUnhideApplication(wapp
, False
, False
);
503 scr
= wScreenForRootWindow(ev
->xmaprequest
.parent
);
505 wwin
= wManageWindow(scr
, window
);
508 * This is to let the Dock know that the application it launched
509 * has already been mapped (eg: it has finished launching).
510 * It is not necessary for normally docked apps, but is needed for
511 * apps that were forcedly docked (like with dockit).
513 if (scr
->last_dock
) {
514 if (wwin
&& wwin
->main_window
!=None
&& wwin
->main_window
!=window
)
515 wDockTrackWindowLaunch(scr
->last_dock
, wwin
->main_window
);
517 wDockTrackWindowLaunch(scr
->last_dock
, window
);
521 wClientSetState(wwin
, NormalState
, None
);
522 if (wwin
->flags
.maximized
) {
523 wMaximizeWindow(wwin
, wwin
->flags
.maximized
);
525 if (wwin
->flags
.shaded
) {
526 wwin
->flags
.shaded
= 0;
527 wwin
->flags
.skip_next_animation
= 1;
530 if (wwin
->flags
.miniaturized
) {
531 wwin
->flags
.miniaturized
= 0;
532 wwin
->flags
.skip_next_animation
= 1;
533 wIconifyWindow(wwin
);
535 if (wwin
->flags
.hidden
) {
536 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
538 wwin
->flags
.hidden
= 0;
539 wwin
->flags
.skip_next_animation
= 1;
541 wHideApplication(wapp
);
549 handleDestroyNotify(XEvent
*event
)
553 Window window
= event
->xdestroywindow
.window
;
556 puts("got destroy notify");
559 wwin
= wWindowFor(window
);
561 wUnmanageWindow(wwin
, False
, True
);
564 app
= wApplicationOf(window
);
566 if (window
== app
->main_window
) {
568 wwin
= app
->main_window_desc
->screen_ptr
->focused_window
;
570 if (wwin
->main_window
== window
) {
571 wwin
->main_window
= None
;
576 wApplicationDestroy(app
);
580 wKWMCheckDestroy(&event
->xdestroywindow
);
587 handleExpose(XEvent
*event
)
589 WObjDescriptor
*desc
;
596 while (XCheckTypedWindowEvent(dpy
, event
->xexpose
.window
, Expose
, &ev
));
598 if (XFindContext(dpy
, event
->xexpose
.window
, wWinContext
,
599 (XPointer
*)&desc
)==XCNOENT
) {
603 if (desc
->handle_expose
) {
604 (*desc
->handle_expose
)(desc
, event
);
611 handleButtonPress(XEvent
*event
)
613 WObjDescriptor
*desc
;
617 puts("got button press");
620 scr
= wScreenForRootWindow(event
->xbutton
.root
);
628 if (event
->xbutton
.window
==scr
->root_win
) {
630 if (event
->xbutton
.button
==wPreferences
.menu_button
) {
631 OpenRootMenu(scr
, event
->xbutton
.x_root
,
632 event
->xbutton
.y_root
, False
);
634 if (scr
->root_menu
) {
635 if (scr
->root_menu
->brother
->flags
.mapped
)
636 event
->xbutton
.window
= scr
->root_menu
->brother
->frame
->core
->window
;
638 event
->xbutton
.window
= scr
->root_menu
->frame
->core
->window
;
640 } else if (event
->xbutton
.button
==wPreferences
.windowl_button
) {
641 OpenSwitchMenu(scr
, event
->xbutton
.x_root
,
642 event
->xbutton
.y_root
, False
);
643 if (scr
->switch_menu
) {
644 if (scr
->switch_menu
->brother
->flags
.mapped
)
645 event
->xbutton
.window
= scr
->switch_menu
->brother
->frame
->core
->window
;
647 event
->xbutton
.window
= scr
->switch_menu
->frame
->core
->window
;
649 } else if (event
->xbutton
.button
==wPreferences
.select_button
) {
650 wUnselectWindows(scr
);
651 wSelectWindows(scr
, event
);
653 #ifdef MOUSE_WS_SWITCH
654 else if (event
->xbutton
.button
==Button5
) {
656 wWorkspaceRelativeChange(scr
, -1);
658 } else if (event
->xbutton
.button
==Button4
) {
660 wWorkspaceRelativeChange(scr
, 1);
663 #endif /* MOUSE_WS_SWITCH */
665 else if (wGNOMEProxyizeButtonEvent(scr
, event
))
671 if (XFindContext(dpy
, event
->xbutton
.subwindow
, wWinContext
,
672 (XPointer
*)&desc
)==XCNOENT
) {
673 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
674 (XPointer
*)&desc
)==XCNOENT
) {
679 if (desc
->handle_mousedown
!=NULL
) {
680 (*desc
->handle_mousedown
)(desc
, event
);
683 if (desc
->parent_type
== WCLASS_WINDOW
) {
686 if (event
->xbutton
.state
& MOD_MASK
) {
687 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
690 if (wPreferences
.focus_mode
== WKF_CLICK
) {
691 if (wPreferences
.ignore_focus_click
) {
692 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
694 XAllowEvents(dpy
, ReplayPointer
, CurrentTime
);
697 } else if (desc
->parent_type
== WCLASS_APPICON
698 || desc
->parent_type
== WCLASS_MINIWINDOW
699 || desc
->parent_type
== WCLASS_DOCK_ICON
) {
700 if (event
->xbutton
.state
& MOD_MASK
) {
702 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
707 /* save double-click information */
708 if (scr
->flags
.next_click_is_not_double
) {
709 scr
->flags
.next_click_is_not_double
= 0;
711 scr
->last_click_time
= event
->xbutton
.time
;
712 scr
->last_click_button
= event
->xbutton
.button
;
713 scr
->last_click_window
= event
->xbutton
.window
;
719 handleMapNotify(XEvent
*event
)
727 wwin
= wWindowFor(event
->xmap
.event
);
728 if (wwin
&& wwin
->client_win
== event
->xmap
.event
) {
729 if (wwin
->flags
.miniaturized
) {
730 wDeiconifyWindow(wwin
);
734 wClientSetState(wwin
, NormalState
, None
);
742 handleUnmapNotify(XEvent
*event
)
746 Bool withdraw
= False
;
752 /* only process windows with StructureNotify selected
753 * (ignore SubstructureNotify) */
754 wwin
= wWindowFor(event
->xunmap
.window
);
758 /* whether the event is a Withdrawal request */
759 if (event
->xunmap
.event
== wwin
->screen_ptr
->root_win
760 && event
->xunmap
.send_event
)
763 if (wwin
->client_win
!= event
->xunmap
.event
&& !withdraw
)
766 if (!wwin
->flags
.mapped
&& !withdraw
767 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
768 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
)
772 XUnmapWindow(dpy
, wwin
->frame
->core
->window
);
773 wwin
->flags
.mapped
= 0;
775 /* check if the window was destroyed */
776 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, DestroyNotify
,&ev
)) {
779 Bool reparented
= False
;
781 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, ReparentNotify
, &ev
))
784 /* withdraw window */
785 wwin
->flags
.mapped
= 0;
787 wClientSetState(wwin
, WithdrawnState
, None
);
789 /* if the window was reparented, do not reparent it back to the
791 wUnmanageWindow(wwin
, !reparented
, False
);
798 handleConfigureRequest(XEvent
*event
)
803 puts("got configure request");
805 if (!(wwin
=wWindowFor(event
->xconfigurerequest
.window
))) {
807 * Configure request for unmapped window
809 wClientConfigure(NULL
, &(event
->xconfigurerequest
));
811 wClientConfigure(wwin
, &(event
->xconfigurerequest
));
817 handlePropertyNotify(XEvent
*event
)
827 puts("got property notify");
829 if ((wwin
=wWindowFor(event
->xproperty
.window
))) {
830 if (!XGetGeometry(dpy
, wwin
->client_win
, &jr
, &ji
, &ji
,
831 &ju
, &ju
, &ju
, &ju
)) {
834 wClientCheckProperty(wwin
, &event
->xproperty
);
836 wapp
= wApplicationOf(event
->xproperty
.window
);
838 wClientCheckProperty(wapp
->main_window_desc
, &event
->xproperty
);
841 scr
= wScreenForWindow(event
->xproperty
.window
);
842 if (scr
&& scr
->root_win
== event
->xproperty
.window
) {
844 wKWMCheckRootHintChange(scr
, &event
->xproperty
);
851 handleClientMessage(XEvent
*event
)
854 WObjDescriptor
*desc
;
857 puts("got client message");
859 /* handle transition from Normal to Iconic state */
860 if (event
->xclient
.message_type
== _XA_WM_CHANGE_STATE
861 && event
->xclient
.format
== 32
862 && event
->xclient
.data
.l
[0] == IconicState
) {
864 wwin
= wWindowFor(event
->xclient
.window
);
866 if (!wwin
->flags
.miniaturized
)
867 wIconifyWindow(wwin
);
868 } else if (event
->xclient
.message_type
== _XA_WM_COLORMAP_NOTIFY
869 && event
->xclient
.format
== 32) {
870 WScreen
*scr
= wScreenSearchForRootWindow(event
->xclient
.window
);
875 if (event
->xclient
.data
.l
[1] == 1) { /* starting */
876 wColormapAllowClientInstallation(scr
, True
);
877 } else { /* stopping */
878 wColormapAllowClientInstallation(scr
, False
);
880 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_COMMAND
) {
882 wDefaultsCheckDomains("bla");
884 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_WM_FUNCTION
) {
887 wapp
= wApplicationOf(event
->xclient
.window
);
889 switch (event
->xclient
.data
.l
[0]) {
890 case WMFHideOtherApplications
:
891 wHideOtherApplications(wapp
->main_window_desc
);
895 case WMFHideApplication
:
896 wHideApplication(wapp
);
902 wwin
= wWindowFor(event
->xclient
.window
);
904 switch (event
->xclient
.data
.l
[0]) {
905 case WMFHideOtherApplications
:
906 wHideOtherApplications(wwin
);
909 case WMFHideApplication
:
910 wHideApplication(wApplicationOf(wwin
->main_window
));
916 } else if (wGNOMEProcessClientMessage(&event
->xclient
)) {
918 #endif /* GNOME_STUFF */
920 } else if (wKWMProcessClientMessage(&event
->xclient
)) {
922 #endif /* KWM_HINTS */
924 } else if (wXDNDProcessClientMessage(&event
->xclient
)) {
928 } else if (event
->xclient
.message_type
==_XA_DND_PROTOCOL
) {
929 WScreen
*scr
= wScreenForWindow(event
->xclient
.window
);
930 if (scr
&& wDockReceiveDNDDrop(scr
,event
))
931 goto redirect_message
;
932 #endif /* OFFIX_DND */
938 * Non-standard thing, but needed by OffiX DND.
939 * For when the icon frame gets a ClientMessage
940 * that should have gone to the icon_window.
942 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
943 (XPointer
*)&desc
)!=XCNOENT
) {
944 struct WIcon
*icon
=NULL
;
946 if (desc
->parent_type
== WCLASS_MINIWINDOW
) {
947 icon
= (WIcon
*)desc
->parent
;
948 } else if (desc
->parent_type
== WCLASS_DOCK_ICON
949 || desc
->parent_type
== WCLASS_APPICON
) {
950 icon
= ((WAppIcon
*)desc
->parent
)->icon
;
952 if (icon
&& (wwin
=icon
->owner
)) {
953 if (wwin
->client_win
!=event
->xclient
.window
) {
954 event
->xclient
.window
= wwin
->client_win
;
955 XSendEvent(dpy
, wwin
->client_win
, False
, NoEventMask
,
965 raiseWindow(WScreen
*scr
)
969 scr
->autoRaiseTimer
= NULL
;
971 wwin
= wWindowFor(scr
->autoRaiseWindow
);
975 if (!wwin
->flags
.destroyed
&& wwin
->flags
.focused
) {
976 wRaiseFrame(wwin
->frame
->core
);
977 /* this is needed or a race condition will occur */
984 handleEnterNotify(XEvent
*event
)
987 WObjDescriptor
*desc
= NULL
;
989 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
993 puts("got enter notify");
996 if (XCheckTypedWindowEvent(dpy
, event
->xcrossing
.window
, LeaveNotify
,
998 /* already left the window... */
1000 if (ev
.xcrossing
.mode
==event
->xcrossing
.mode
1001 && ev
.xcrossing
.detail
==event
->xcrossing
.detail
) {
1006 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1007 (XPointer
*)&desc
)!=XCNOENT
) {
1008 if(desc
->handle_enternotify
)
1009 (*desc
->handle_enternotify
)(desc
, event
);
1012 /* enter to window */
1013 wwin
= wWindowFor(event
->xcrossing
.window
);
1015 if (wPreferences
.focus_mode
==WKF_POINTER
1016 && event
->xcrossing
.window
==event
->xcrossing
.root
) {
1017 wSetFocusTo(scr
, NULL
);
1019 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1020 wColormapInstallForWindow(scr
, NULL
);
1022 if (scr
->autoRaiseTimer
1023 && event
->xcrossing
.root
==event
->xcrossing
.window
) {
1024 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1025 scr
->autoRaiseTimer
= NULL
;
1028 /* set auto raise timer even if in focus-follows-mouse mode
1029 * and the event is for the frame window, even if the window
1030 * has focus already. useful if you move the pointer from a focused
1031 * window to the root window and back pretty fast
1033 * set focus if in focus-follows-mouse mode and the event
1034 * is for the frame window and window doesn't have focus yet */
1035 if ((wPreferences
.focus_mode
==WKF_POINTER
1036 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1037 && wwin
->frame
->core
->window
==event
->xcrossing
.window
1038 && !scr
->flags
.doing_alt_tab
) {
1040 if (!wwin
->flags
.focused
&& !WFLAGP(wwin
, no_focusable
))
1041 wSetFocusTo(scr
, wwin
);
1043 if (scr
->autoRaiseTimer
)
1044 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1045 scr
->autoRaiseTimer
= NULL
;
1047 if (wPreferences
.raise_delay
&& !WFLAGP(wwin
, no_focusable
)) {
1048 scr
->autoRaiseWindow
= wwin
->frame
->core
->window
;
1050 = WMAddTimerHandler(wPreferences
.raise_delay
,
1051 (WMCallback
*)raiseWindow
, scr
);
1054 /* Install colormap for window, if the colormap installation mode
1055 * is colormap_follows_mouse */
1056 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1057 if (wwin
->client_win
==event
->xcrossing
.window
)
1058 wColormapInstallForWindow(scr
, wwin
);
1060 wColormapInstallForWindow(scr
, NULL
);
1064 /* a little kluge to hide the clip balloon */
1065 if (!wPreferences
.flags
.noclip
&& scr
->flags
.clip_balloon_mapped
) {
1067 XUnmapWindow(dpy
, scr
->clip_balloon
);
1068 scr
->flags
.clip_balloon_mapped
= 0;
1070 if (desc
->parent_type
!=WCLASS_DOCK_ICON
1071 || scr
->clip_icon
!= desc
->parent
) {
1072 XUnmapWindow(dpy
, scr
->clip_balloon
);
1073 scr
->flags
.clip_balloon_mapped
= 0;
1078 if (event
->xcrossing
.window
== event
->xcrossing
.root
1079 && event
->xcrossing
.detail
== NotifyNormal
1080 && event
->xcrossing
.detail
!= NotifyInferior
1081 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1083 wSetFocusTo(scr
, scr
->focused_window
);
1087 wBalloonEnteredObject(scr
, desc
);
1093 handleLeaveNotify(XEvent
*event
)
1095 WObjDescriptor
*desc
= NULL
;
1097 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1098 (XPointer
*)&desc
)!=XCNOENT
) {
1099 if(desc
->handle_leavenotify
)
1100 (*desc
->handle_leavenotify
)(desc
, event
);
1102 if (event
->xcrossing
.window
== event
->xcrossing
.root
1103 && event
->xcrossing
.mode
== NotifyNormal
1104 && event
->xcrossing
.detail
!= NotifyInferior
1105 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1107 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1109 wSetFocusTo(scr
, NULL
);
1116 handleShapeNotify(XEvent
*event
)
1118 XShapeEvent
*shev
= (XShapeEvent
*)event
;
1123 puts("got shape notify");
1126 while (XCheckTypedWindowEvent(dpy
, shev
->window
, event
->type
, &ev
)) {
1127 XShapeEvent
*sev
= (XShapeEvent
*)&ev
;
1129 if (sev
->kind
== ShapeBounding
) {
1130 if (sev
->shaped
== shev
->shaped
) {
1133 XPutBackEvent(dpy
, &ev
);
1139 wwin
= wWindowFor(shev
->window
);
1140 if (!wwin
|| shev
->kind
!= ShapeBounding
)
1143 if (!shev
->shaped
&& wwin
->flags
.shaped
) {
1145 wwin
->flags
.shaped
= 0;
1146 wWindowClearShape(wwin
);
1148 } else if (shev
->shaped
) {
1150 wwin
->flags
.shaped
= 1;
1151 wWindowSetShape(wwin
);
1156 #ifdef KEEP_XKB_LOCK_STATUS
1157 /* please help ]d if you know what to do */
1158 handleXkbIndicatorStateNotify(XEvent
*event
)
1162 XkbStateRec staterec
;
1165 for (i
=0; i
<wScreenCount
; i
++) {
1166 scr
= wScreenWithNumber(i
);
1167 wwin
= scr
->focused_window
;
1168 if (wwin
&& wwin
->flags
.focused
) {
1169 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1170 if (wwin
->frame
->languagemode
!= staterec
.group
) {
1171 wwin
->frame
->last_languagemode
= wwin
->frame
->languagemode
;
1172 wwin
->frame
->languagemode
= staterec
.group
;
1174 #ifdef XKB_BUTTON_HINT
1175 if (wwin
->frame
->titlebar
) {
1176 wFrameWindowPaint(wwin
->frame
);
1182 #endif /*KEEP_XKB_LOCK_STATUS*/
1185 handleColormapNotify(XEvent
*event
)
1189 Bool reinstall
= False
;
1191 wwin
= wWindowFor(event
->xcolormap
.window
);
1195 scr
= wwin
->screen_ptr
;
1199 if (event
->xcolormap
.new) {
1200 XWindowAttributes attr
;
1202 XGetWindowAttributes(dpy
, wwin
->client_win
, &attr
);
1204 if (wwin
== scr
->cmap_window
&& wwin
->cmap_window_no
== 0)
1205 scr
->current_colormap
= attr
.colormap
;
1208 } else if (event
->xcolormap
.state
== ColormapUninstalled
&&
1209 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1211 /* some bastard app (like XV) removed our colormap */
1213 * can't enforce or things like xscreensaver wont work
1216 } else if (event
->xcolormap
.state
== ColormapInstalled
&&
1217 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1219 /* someone has put our colormap back */
1223 } while (XCheckTypedEvent(dpy
, ColormapNotify
, event
)
1224 && ((wwin
= wWindowFor(event
->xcolormap
.window
)) || 1));
1226 if (reinstall
&& scr
->current_colormap
!=None
) {
1227 if (!scr
->flags
.colormap_stuff_blocked
)
1228 XInstallColormap(dpy
, scr
->current_colormap
);
1235 handleFocusIn(XEvent
*event
)
1240 * For applications that like stealing the focus.
1242 while (XCheckTypedEvent(dpy
, FocusIn
, event
));
1243 saveTimestamp(event
);
1244 if (event
->xfocus
.mode
== NotifyUngrab
1245 || event
->xfocus
.mode
== NotifyGrab
1246 || event
->xfocus
.detail
> NotifyNonlinearVirtual
) {
1250 wwin
= wWindowFor(event
->xfocus
.window
);
1251 if (wwin
&& !wwin
->flags
.focused
) {
1252 if (wwin
->flags
.mapped
)
1253 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1255 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1257 WScreen
*scr
= wScreenForWindow(event
->xfocus
.window
);
1259 wSetFocusTo(scr
, NULL
);
1265 windowUnderPointer(WScreen
*scr
)
1271 if (XQueryPointer(dpy
, scr
->root_win
, &bar
, &win
, &foo
, &foo
, &foo
, &foo
,
1273 return wWindowFor(win
);
1277 #ifdef WEENDOZE_CYCLE
1280 nextToFocusAfter(WWindow
*wwin
)
1282 WWindow
*tmp
= wwin
->prev
;
1285 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1293 /* start over from the beginning of the list */
1297 while (tmp
&& tmp
!= wwin
) {
1298 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1310 nextToFocusBefore(WWindow
*wwin
)
1312 WWindow
*tmp
= wwin
->next
;
1315 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1322 /* start over from the beginning of the list */
1327 while (tmp
&& tmp
!= wwin
) {
1328 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1339 doWindozeCycle(WWindow
*wwin
, XEvent
*event
, Bool next
)
1341 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1343 Bool openedSwitchMenu
= False
;
1344 WWindow
*newFocused
;
1345 WWindow
*oldFocused
;
1347 XModifierKeymap
*keymap
;
1353 keymap
= XGetModifierMapping(dpy
);
1356 XGrabKeyboard(dpy
, scr
->root_win
, False
, GrabModeAsync
, GrabModeAsync
,
1360 newFocused
= nextToFocusAfter(wwin
);
1362 newFocused
= nextToFocusBefore(wwin
);
1365 scr
->flags
.doing_alt_tab
= 1;
1367 wWindowFocus(newFocused
, scr
->focused_window
);
1368 oldFocused
= newFocused
;
1369 if (wPreferences
.circ_raise
)
1370 wRaiseFrame(newFocused
->frame
->core
);
1372 if (wPreferences
.popup_switchmenu
&&
1373 (!scr
->switch_menu
|| !scr
->switch_menu
->flags
.mapped
)) {
1375 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, False
);
1376 openedSwitchMenu
= True
;
1382 WMMaskEvent(dpy
,KeyPressMask
|KeyReleaseMask
|ExposureMask
, &ev
);
1383 /* WMNextEvent(dpy, &ev);*/
1384 if (ev
.type
!= KeyRelease
&& ev
.type
!= KeyPress
) {
1389 /* ignore CapsLock */
1390 modifiers
= ev
.xkey
.state
& ValidModMask
;
1392 if (ev
.type
== KeyPress
1393 && wKeyBindings
[WKBD_FOCUSNEXT
].keycode
== ev
.xkey
.keycode
1394 && wKeyBindings
[WKBD_FOCUSNEXT
].modifier
== modifiers
) {
1396 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1397 newFocused
= nextToFocusAfter(newFocused
);
1398 wWindowFocus(newFocused
, oldFocused
);
1399 oldFocused
= newFocused
;
1400 if (wPreferences
.circ_raise
)
1401 wRaiseFrame(newFocused
->frame
->core
);
1402 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1404 } else if (ev
.type
== KeyPress
1405 && wKeyBindings
[WKBD_FOCUSPREV
].keycode
== ev
.xkey
.keycode
1406 && wKeyBindings
[WKBD_FOCUSPREV
].modifier
== modifiers
) {
1408 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1409 newFocused
= nextToFocusBefore(newFocused
);
1410 wWindowFocus(newFocused
, oldFocused
);
1411 oldFocused
= newFocused
;
1412 if (wPreferences
.circ_raise
)
1413 wRaiseFrame(newFocused
->frame
->core
);
1414 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1416 if (ev
.type
== KeyRelease
) {
1419 for (i
= 0; i
<= 8 * keymap
->max_keypermod
; i
++) {
1420 if (keymap
->modifiermap
[i
] == ev
.xkey
.keycode
&&
1421 wKeyBindings
[WKBD_FOCUSNEXT
].modifier
1422 & 1<<(i
/keymap
->max_keypermod
)) {
1432 XUngrabKeyboard(dpy
, CurrentTime
);
1433 wSetFocusTo(scr
, newFocused
);
1434 scr
->flags
.doing_alt_tab
= 0;
1435 if (openedSwitchMenu
)
1436 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, False
);
1440 #endif /* WEENDOZE_CYCLE */
1446 handleKeyPress(XEvent
*event
)
1448 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1449 WWindow
*wwin
= scr
->focused_window
;
1453 #ifdef KEEP_XKB_LOCK_STATUS
1454 XkbStateRec staterec
;
1455 #endif /*KEEP_XKB_LOCK_STATUS*/
1457 /* ignore CapsLock */
1458 modifiers
= event
->xkey
.state
& ValidModMask
;
1460 for (i
=0; i
<WKBD_LAST
; i
++) {
1461 if (wKeyBindings
[i
].keycode
==0)
1464 if (wKeyBindings
[i
].keycode
==event
->xkey
.keycode
1465 && (/*wKeyBindings[i].modifier==0
1466 ||*/ wKeyBindings
[i
].modifier
==modifiers
)) {
1479 if (!wRootMenuPerformShortcut(event
)) {
1481 static int dontLoop
= 0;
1483 if (dontLoop
> 10) {
1484 wwarning("problem with key event processing code");
1488 /* if the focused window is an internal window, try redispatching
1489 * the event to the managed window, as it can be a WINGs window */
1490 if (wwin
&& wwin
->flags
.internal_window
1491 && wwin
->client_leader
!=None
) {
1492 /* client_leader contains the WINGs toplevel */
1493 event
->xany
.window
= wwin
->client_leader
;
1494 WMHandleEvent(event
);
1501 #define ISMAPPED(w) ((w) && !(w)->flags.miniaturized && ((w)->flags.mapped || (w)->flags.shaded))
1502 #define ISFOCUSED(w) ((w) && (w)->flags.focused)
1507 OpenRootMenu(scr
, event
->xkey
.x_root
, event
->xkey
.y_root
, True
);
1509 case WKBD_WINDOWLIST
:
1510 OpenSwitchMenu(scr
, event
->xkey
.x_root
, event
->xkey
.y_root
, True
);
1513 case WKBD_WINDOWMENU
:
1514 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
))
1515 OpenWindowMenu(wwin
, wwin
->frame_x
,
1516 wwin
->frame_y
+wwin
->frame
->top_width
, True
);
1518 case WKBD_MINIATURIZE
:
1519 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)
1520 && !WFLAGP(wwin
, no_miniaturizable
)) {
1521 CloseWindowMenu(scr
);
1523 if (wwin
->protocols
.MINIATURIZE_WINDOW
)
1524 wClientSendProtocol(wwin
, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
,
1525 event
->xbutton
.time
);
1527 wIconifyWindow(wwin
);
1532 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1533 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1534 CloseWindowMenu(scr
);
1536 if (wapp
&& !WFLAGP(wapp
->main_window_desc
, no_appicon
)) {
1537 wHideApplication(wapp
);
1542 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1543 CloseWindowMenu(scr
);
1545 if (wwin
->flags
.maximized
) {
1546 wUnmaximizeWindow(wwin
);
1548 wMaximizeWindow(wwin
, MAX_VERTICAL
|MAX_HORIZONTAL
);
1552 case WKBD_VMAXIMIZE
:
1553 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1554 CloseWindowMenu(scr
);
1556 if (wwin
->flags
.maximized
) {
1557 wUnmaximizeWindow(wwin
);
1559 wMaximizeWindow(wwin
, MAX_VERTICAL
);
1564 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1565 CloseWindowMenu(scr
);
1567 wRaiseFrame(wwin
->frame
->core
);
1571 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1572 CloseWindowMenu(scr
);
1574 wLowerFrame(wwin
->frame
->core
);
1577 case WKBD_RAISELOWER
:
1578 /* raise or lower the window under the pointer, not the
1581 wwin
= windowUnderPointer(scr
);
1583 wRaiseLowerFrame(wwin
->frame
->core
);
1586 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_shadeable
)) {
1587 if (wwin
->flags
.shaded
)
1588 wUnshadeWindow(wwin
);
1593 case WKBD_MOVERESIZE
:
1594 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1595 CloseWindowMenu(scr
);
1597 wKeyboardMoveResizeWindow(wwin
);
1601 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_closable
)) {
1602 CloseWindowMenu(scr
);
1603 if (wwin
->protocols
.DELETE_WINDOW
)
1604 wClientSendProtocol(wwin
, _XA_WM_DELETE_WINDOW
,
1609 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1610 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1613 case WKBD_FOCUSNEXT
:
1614 #ifdef WEENDOZE_CYCLE
1615 if (wPreferences
.windoze_cycling
) {
1616 doWindozeCycle(wwin
, event
, True
);
1618 #endif /* WEENDOZE_CYCLE */
1620 wwin
= NextFocusWindow(scr
);
1622 wSetFocusTo(scr
, wwin
);
1623 if (wPreferences
.circ_raise
)
1624 wRaiseFrame(wwin
->frame
->core
);
1629 case WKBD_FOCUSPREV
:
1630 #ifdef WEENDOZE_CYCLE
1631 if (wPreferences
.windoze_cycling
) {
1632 doWindozeCycle(wwin
, event
, False
);
1634 #endif /* WEENDOZE_CYCLE */
1636 wwin
= PrevFocusWindow(scr
);
1638 wSetFocusTo(scr
, wwin
);
1639 if (wPreferences
.circ_raise
)
1640 wRaiseFrame(wwin
->frame
->core
);
1645 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
1646 #define GOTOWORKS(wk) case WKBD_WORKSPACE##wk:\
1647 i = (scr->current_workspace/10)*10 + wk - 1;\
1648 if (wPreferences.ws_advance || i<scr->workspace_count)\
1649 wWorkspaceChange(scr, i);\
1652 #define GOTOWORKS(wk) case WKBD_WORKSPACE/**/wk:\
1653 i = (scr->current_workspace/10)*10 + wk - 1;\
1654 if (wPreferences.ws_advance || i<scr->workspace_count)\
1655 wWorkspaceChange(scr, i);\
1669 case WKBD_NEXTWORKSPACE
:
1670 wWorkspaceRelativeChange(scr
, 1);
1672 case WKBD_PREVWORKSPACE
:
1673 wWorkspaceRelativeChange(scr
, -1);
1679 #ifdef EXTEND_WINDOWSHORTCUT
1687 if ( scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]) {
1688 LinkedList
*list
= scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
];
1691 wUnselectWindows(scr
);
1692 if (scr
->shortcutWindow
[command
-WKBD_WINDOW1
])
1693 wMakeWindowVisible(scr
->shortcutWindow
[command
-WKBD_WINDOW1
]);
1694 cw
= scr
->current_workspace
;
1696 wWindowChangeWorkspace(list
->head
, cw
);
1697 wMakeWindowVisible(list
->head
);
1698 wSelectWindow(list
->head
, True
);
1701 } else if (scr
->shortcutWindow
[command
-WKBD_WINDOW1
]){
1703 wMakeWindowVisible(scr
->shortcutWindow
[command
-WKBD_WINDOW1
]);
1705 } else if (wwin
&& ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1707 scr
->shortcutWindow
[command
-WKBD_WINDOW1
] = wwin
;
1708 if (wwin
->flags
.selected
/* && scr->selected_windows */ ) {
1711 sl
= scr
->selected_windows
;
1712 list_free(scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1715 scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
] = list_cons(sl
->head
,scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1719 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1722 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1725 } else if (scr
->selected_windows
) {
1727 if (wwin
->flags
.selected
/* && scr->selected_windows */ ) {
1730 sl
= scr
->selected_windows
;
1731 list_free(scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1734 scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
] = list_cons(sl
->head
,scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1741 case WKBD_NEXTWSLAYER
:
1742 case WKBD_PREVWSLAYER
:
1746 row
= scr
->current_workspace
/10;
1747 column
= scr
->current_workspace
%10;
1749 if (command
==WKBD_NEXTWSLAYER
) {
1750 if ((row
+1)*10 < scr
->workspace_count
)
1751 wWorkspaceChange(scr
, column
+(row
+1)*10);
1754 wWorkspaceChange(scr
, column
+(row
-1)*10);
1758 case WKBD_CLIPLOWER
:
1759 if (!wPreferences
.flags
.noclip
)
1760 wDockLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1762 case WKBD_CLIPRAISE
:
1763 if (!wPreferences
.flags
.noclip
)
1764 wDockRaise(scr
->workspaces
[scr
->current_workspace
]->clip
);
1766 case WKBD_CLIPRAISELOWER
:
1767 if (!wPreferences
.flags
.noclip
)
1768 wDockRaiseLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1770 #ifdef KEEP_XKB_LOCK_STATUS
1772 if(wPreferences
.modelock
) {
1774 wwin
= scr
->focused_window
;
1776 if (wwin
&& wwin
->flags
.mapped
1777 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
1778 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
) {
1779 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1781 wwin
->frame
->languagemode
= wwin
->frame
->last_languagemode
;
1782 wwin
->frame
->last_languagemode
= staterec
.group
;
1783 XkbLockGroup(dpy
,XkbUseCoreKbd
, wwin
->frame
->languagemode
);
1788 #endif /* KEEP_XKB_LOCK_STATUS */
1795 handleMotionNotify(XEvent
*event
)
1798 WScreen
*scr
= wScreenForRootWindow(event
->xmotion
.root
);
1800 if (wPreferences
.scrollable_menus
) {
1801 if (scr
->flags
.jump_back_pending
||
1802 event
->xmotion
.x_root
<= 1 ||
1803 event
->xmotion
.x_root
>= (scr
->scr_width
- 2) ||
1804 event
->xmotion
.y_root
<= 1 ||
1805 event
->xmotion
.y_root
>= (scr
->scr_height
- 2)) {
1808 puts("pointer at screen edge");
1811 menu
= wMenuUnderPointer(scr
);
1813 wMenuScroll(menu
, event
);
1817 if (event
->xmotion
.subwindow
== None
)
1820 if (scr
->scrolledFMaximize
!= None
) {
1823 twin
= wWindowFor(scr
->scrolledFMaximize
);
1824 if (twin
&& twin
->frame_y
==) {
1828 scr
->scrolledFMaximize
= NULL
;
1832 /* scroll full maximized window */
1833 if (event
->xmotion
.y_root
< 1
1834 || event
->xmotion
.y_root
> scr
->scr_height
- 1) {
1836 wwin
= wWindowFor(event
->xmotion
.subwindow
);
1838 if (wwin
&& (wwin
->flags
.maximized
& MAX_VERTICAL
)
1839 && WFLAGP(wwin
, full_maximize
)
1840 && event
->xmotion
.x_root
>= wwin
->frame_x
1841 && event
->xmotion
.x_root
<= wwin
->frame_x
+ wwin
->frame
->core
->width
) {
1843 if (!WFLAGP(wwin
, no_titlebar
)
1844 && wwin
->frame_y
<= - wwin
->frame
->top_width
) {
1846 wWindowMove(wwin
, wwin
->frame_x
, 0);
1847 wwin
->flags
.dragged_while_fmaximized
= 0;
1849 } else if (!WFLAGP(wwin
, no_resizebar
)
1850 && wwin
->frame_y
+ wwin
->frame
->core
->height
>=
1851 scr
->scr_height
+ wwin
->frame
->bottom_width
) {
1853 int y
= scr
->scr_height
+ wwin
->frame
->bottom_width
;
1855 y
= scr
->scr_height
- wwin
->frame_y
- wwin
->frame
->core
->height
;
1857 wWindowMove(wwin
, wwin
->frame_x
, y
);
1858 wwin
->flags
.dragged_while_fmaximized
= 0;
1867 handleVisibilityNotify(XEvent
*event
)
1871 wwin
= wWindowFor(event
->xvisibility
.window
);
1874 wwin
->flags
.obscured
=
1875 (event
->xvisibility
.state
== VisibilityFullyObscured
);