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
;
100 extern char WDelayedActionSet
;
103 /************ Local stuff ***********/
106 static void saveTimestamp(XEvent
*event
);
107 static void handleColormapNotify();
108 static void handleMapNotify(), handleUnmapNotify();
109 static void handleButtonPress(), handleExpose();
110 static void handleDestroyNotify();
111 static void handleConfigureRequest();
112 static void handleMapRequest();
113 static void handlePropertyNotify();
114 static void handleEnterNotify();
115 static void handleLeaveNotify();
116 static void handleExtensions();
117 static void handleClientMessage();
118 static void handleKeyPress();
119 static void handleFocusIn();
120 static void handleMotionNotify();
121 static void handleVisibilityNotify();
125 static void handleShapeNotify();
128 /* called from the signal handler */
129 void NotifyDeadProcess(pid_t pid
, unsigned char status
);
131 /* real dead process handler */
132 static void handleDeadProcess(void *foo
);
135 typedef struct DeadProcesses
{
137 unsigned char exit_status
;
140 /* stack of dead processes */
141 static DeadProcesses deadProcesses
[MAX_DEAD_PROCESSES
];
142 static int deadProcessPtr
=0;
145 typedef struct DeathHandler
{
146 WDeathHandler
*callback
;
148 struct DeathHandler
*next
;
152 static DeathHandler
*deathHandler
=NULL
;
157 wAddDeathHandler(pid_t pid
, WDeathHandler
*callback
, void *cdata
)
159 DeathHandler
*handler
;
161 handler
= malloc(sizeof(DeathHandler
));
166 handler
->callback
= callback
;
167 handler
->client_data
= cdata
;
169 handler
->next
= deathHandler
;
171 deathHandler
= handler
;
179 wDeleteDeathHandler(WMagicNumber id
)
181 DeathHandler
*tmp
, *handler
=(DeathHandler
*)id
;
183 if (!handler
|| !deathHandler
)
188 deathHandler
= handler
->next
;
192 if (tmp
->next
==handler
) {
193 tmp
->next
=handler
->next
;
204 DispatchEvent(XEvent
*event
)
207 handleDeadProcess(NULL
);
209 if (WCHECK_STATE(WSTATE_NEED_EXIT
)) {
210 WCHANGE_STATE(WSTATE_EXITING
);
211 /* received SIGTERM */
213 * WMHandleEvent() can't be called from anything
214 * executed inside here, or we can get in a infinite
217 Shutdown(WSExitMode
);
219 } else if (WCHECK_STATE(WSTATE_NEED_RESTART
)) {
220 WCHANGE_STATE(WSTATE_RESTARTING
);
222 Shutdown(WSRestartPreparationMode
);
223 /* received SIGHUP */
227 /* for the case that all that is wanted to be dispatched is
232 saveTimestamp(event
);
233 switch (event
->type
) {
235 handleMapRequest(event
);
239 handleKeyPress(event
);
243 handleMotionNotify(event
);
246 case ConfigureRequest
:
247 handleConfigureRequest(event
);
251 handleDestroyNotify(event
);
255 handleMapNotify(event
);
259 handleUnmapNotify(event
);
263 handleButtonPress(event
);
271 handlePropertyNotify(event
);
275 handleEnterNotify(event
);
279 handleLeaveNotify(event
);
283 handleClientMessage(event
);
287 handleColormapNotify(event
);
291 if (event
->xmapping
.request
== MappingKeyboard
292 || event
->xmapping
.request
== MappingModifier
)
293 XRefreshKeyboardMapping(&event
->xmapping
);
297 handleFocusIn(event
);
300 case VisibilityNotify
:
301 handleVisibilityNotify(event
);
304 handleExtensions(event
);
311 *----------------------------------------------------------------------
313 * Processes X and internal events indefinitely.
319 * The LastTimestamp global variable is updated.
320 *----------------------------------------------------------------------
328 WMNextEvent(dpy
, &event
);
329 WMHandleEvent(&event
);
336 IsDoubleClick(WScreen
*scr
, XEvent
*event
)
338 if ((scr
->last_click_time
>0) &&
339 (event
->xbutton
.time
-scr
->last_click_time
<=wPreferences
.dblclick_time
)
340 && (event
->xbutton
.button
== scr
->last_click_button
)
341 && (event
->xbutton
.window
== scr
->last_click_window
)) {
343 scr
->flags
.next_click_is_not_double
= 1;
344 scr
->last_click_time
= 0;
345 scr
->last_click_window
= event
->xbutton
.window
;
354 NotifyDeadProcess(pid_t pid
, unsigned char status
)
356 if (deadProcessPtr
>=MAX_DEAD_PROCESSES
-1) {
357 wwarning("stack overflow: too many dead processes");
360 /* stack the process to be handled later,
361 * as this is called from the signal handler */
362 deadProcesses
[deadProcessPtr
].pid
= pid
;
363 deadProcesses
[deadProcessPtr
].exit_status
= status
;
369 handleDeadProcess(void *foo
)
374 for (i
=0; i
<deadProcessPtr
; i
++) {
375 wWindowDeleteSavedStatesForPID(deadProcesses
[i
].pid
);
383 /* get the pids on the queue and call handlers */
384 while (deadProcessPtr
>0) {
393 if (tmp
->pid
== deadProcesses
[deadProcessPtr
].pid
) {
394 (*tmp
->callback
)(tmp
->pid
,
395 deadProcesses
[deadProcessPtr
].exit_status
,
397 wDeleteDeathHandler(tmp
);
406 saveTimestamp(XEvent
*event
)
408 WScreen
*scr
= wScreenForWindow(event
->xany
.window
);
409 LastTimestamp
= CurrentTime
;
411 switch (event
->type
) {
414 LastTimestamp
= event
->xbutton
.time
;
418 LastTimestamp
= event
->xkey
.time
;
421 LastTimestamp
= event
->xmotion
.time
;
424 LastTimestamp
= event
->xproperty
.time
;
428 LastTimestamp
= event
->xcrossing
.time
;
431 LastTimestamp
= event
->xselectionclear
.time
;
433 case SelectionRequest
:
434 LastTimestamp
= event
->xselectionrequest
.time
;
436 case SelectionNotify
:
437 LastTimestamp
= event
->xselection
.time
;
439 wXDNDProcessSelection(event
);
447 handleExtensions(XEvent
*event
)
452 if (wShapeSupported
&& event
->type
== (wShapeEventBase
+ShapeNotify
)) {
453 handleShapeNotify(event
);
456 #ifdef KEEP_XKB_LOCK_STATUS
457 if (wPreferences
.modelock
&&
458 (event
->type
== 0x54)){
459 /* if someone know how to call this 0x50
460 * or how to clean code this please tell ]d */
461 handleXkbIndicatorStateNotify(event
);
463 #endif /*KEEP_XKB_LOCK_STATUS*/
468 handleMapRequest(XEvent
*ev
)
472 Window window
= ev
->xmaprequest
.window
;
475 printf("got map request for %x\n", (unsigned)window
);
478 if ((wwin
= wWindowFor(window
))) {
479 if (wwin
->flags
.shaded
) {
480 wUnshadeWindow(wwin
);
482 /* deiconify window */
483 if (wwin
->flags
.miniaturized
) {
484 wDeiconifyWindow(wwin
);
485 } else if (wwin
->flags
.hidden
) {
486 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
487 /* go to the last workspace that the user worked on the app */
488 #ifndef REDUCE_APPICONS
489 /* This severely breaks REDUCE_APPICONS. last_workspace is a neat
490 * concept but it needs to be reworked to handle REDUCE_APPICONS -cls
493 wWorkspaceChange(wwin
->screen_ptr
, wapp
->last_workspace
);
496 wUnhideApplication(wapp
, False
, False
);
501 scr
= wScreenForRootWindow(ev
->xmaprequest
.parent
);
503 wwin
= wManageWindow(scr
, window
);
506 * This is to let the Dock know that the application it launched
507 * has already been mapped (eg: it has finished launching).
508 * It is not necessary for normally docked apps, but is needed for
509 * apps that were forcedly docked (like with dockit).
511 if (scr
->last_dock
) {
512 if (wwin
&& wwin
->main_window
!=None
&& wwin
->main_window
!=window
)
513 wDockTrackWindowLaunch(scr
->last_dock
, wwin
->main_window
);
515 wDockTrackWindowLaunch(scr
->last_dock
, window
);
519 wClientSetState(wwin
, NormalState
, None
);
520 if (wwin
->flags
.maximized
) {
521 wMaximizeWindow(wwin
, wwin
->flags
.maximized
);
523 if (wwin
->flags
.shaded
) {
524 wwin
->flags
.shaded
= 0;
525 wwin
->flags
.skip_next_animation
= 1;
528 if (wwin
->flags
.miniaturized
) {
529 wwin
->flags
.miniaturized
= 0;
530 wwin
->flags
.skip_next_animation
= 1;
531 wIconifyWindow(wwin
);
533 if (wwin
->flags
.hidden
) {
534 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
536 wwin
->flags
.hidden
= 0;
537 wwin
->flags
.skip_next_animation
= 1;
539 wHideApplication(wapp
);
547 handleDestroyNotify(XEvent
*event
)
551 Window window
= event
->xdestroywindow
.window
;
554 puts("got destroy notify");
557 wwin
= wWindowFor(window
);
559 wUnmanageWindow(wwin
, False
, True
);
562 app
= wApplicationOf(window
);
564 if (window
== app
->main_window
) {
566 wwin
= app
->main_window_desc
->screen_ptr
->focused_window
;
568 if (wwin
->main_window
== window
) {
569 wwin
->main_window
= None
;
574 wApplicationDestroy(app
);
578 wKWMCheckDestroy(&event
->xdestroywindow
);
585 handleExpose(XEvent
*event
)
587 WObjDescriptor
*desc
;
594 while (XCheckTypedWindowEvent(dpy
, event
->xexpose
.window
, Expose
, &ev
));
596 if (XFindContext(dpy
, event
->xexpose
.window
, wWinContext
,
597 (XPointer
*)&desc
)==XCNOENT
) {
601 if (desc
->handle_expose
) {
602 (*desc
->handle_expose
)(desc
, event
);
609 handleButtonPress(XEvent
*event
)
611 WObjDescriptor
*desc
;
615 puts("got button press");
618 scr
= wScreenForRootWindow(event
->xbutton
.root
);
626 if (event
->xbutton
.window
==scr
->root_win
) {
628 if (event
->xbutton
.button
==wPreferences
.menu_button
) {
629 OpenRootMenu(scr
, event
->xbutton
.x_root
,
630 event
->xbutton
.y_root
, False
);
632 if (scr
->root_menu
) {
633 if (scr
->root_menu
->brother
->flags
.mapped
)
634 event
->xbutton
.window
= scr
->root_menu
->brother
->frame
->core
->window
;
636 event
->xbutton
.window
= scr
->root_menu
->frame
->core
->window
;
638 } else if (event
->xbutton
.button
==wPreferences
.windowl_button
) {
639 OpenSwitchMenu(scr
, event
->xbutton
.x_root
,
640 event
->xbutton
.y_root
, False
);
641 if (scr
->switch_menu
) {
642 if (scr
->switch_menu
->brother
->flags
.mapped
)
643 event
->xbutton
.window
= scr
->switch_menu
->brother
->frame
->core
->window
;
645 event
->xbutton
.window
= scr
->switch_menu
->frame
->core
->window
;
647 } else if (event
->xbutton
.button
==wPreferences
.select_button
) {
648 wUnselectWindows(scr
);
649 wSelectWindows(scr
, event
);
651 #ifdef MOUSE_WS_SWITCH
652 else if (event
->xbutton
.button
==Button5
) {
654 wWorkspaceRelativeChange(scr
, -1);
656 } else if (event
->xbutton
.button
==Button4
) {
658 wWorkspaceRelativeChange(scr
, 1);
661 #endif /* MOUSE_WS_SWITCH */
663 else if (wGNOMEProxyizeButtonEvent(scr
, event
))
669 if (XFindContext(dpy
, event
->xbutton
.subwindow
, wWinContext
,
670 (XPointer
*)&desc
)==XCNOENT
) {
671 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
672 (XPointer
*)&desc
)==XCNOENT
) {
677 if (desc
->handle_mousedown
!=NULL
) {
678 (*desc
->handle_mousedown
)(desc
, event
);
681 if (desc
->parent_type
== WCLASS_WINDOW
) {
684 if (event
->xbutton
.state
& MOD_MASK
) {
685 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
688 if (wPreferences
.focus_mode
== WKF_CLICK
) {
689 if (wPreferences
.ignore_focus_click
) {
690 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
692 XAllowEvents(dpy
, ReplayPointer
, CurrentTime
);
695 } else if (desc
->parent_type
== WCLASS_APPICON
696 || desc
->parent_type
== WCLASS_MINIWINDOW
697 || desc
->parent_type
== WCLASS_DOCK_ICON
) {
698 if (event
->xbutton
.state
& MOD_MASK
) {
700 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
705 /* save double-click information */
706 if (scr
->flags
.next_click_is_not_double
) {
707 scr
->flags
.next_click_is_not_double
= 0;
709 scr
->last_click_time
= event
->xbutton
.time
;
710 scr
->last_click_button
= event
->xbutton
.button
;
711 scr
->last_click_window
= event
->xbutton
.window
;
717 handleMapNotify(XEvent
*event
)
725 wwin
= wWindowFor(event
->xmap
.event
);
726 if (wwin
&& wwin
->client_win
== event
->xmap
.event
) {
727 if (wwin
->flags
.miniaturized
) {
728 wDeiconifyWindow(wwin
);
732 wClientSetState(wwin
, NormalState
, None
);
740 handleUnmapNotify(XEvent
*event
)
744 Bool withdraw
= False
;
750 /* only process windows with StructureNotify selected
751 * (ignore SubstructureNotify) */
752 wwin
= wWindowFor(event
->xunmap
.window
);
756 /* whether the event is a Withdrawal request */
757 if (event
->xunmap
.event
== wwin
->screen_ptr
->root_win
758 && event
->xunmap
.send_event
)
761 if (wwin
->client_win
!= event
->xunmap
.event
&& !withdraw
)
764 if (!wwin
->flags
.mapped
&& !withdraw
765 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
766 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
)
770 XUnmapWindow(dpy
, wwin
->frame
->core
->window
);
771 wwin
->flags
.mapped
= 0;
773 /* check if the window was destroyed */
774 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, DestroyNotify
,&ev
)) {
777 Bool reparented
= False
;
779 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, ReparentNotify
, &ev
))
782 /* withdraw window */
783 wwin
->flags
.mapped
= 0;
785 wClientSetState(wwin
, WithdrawnState
, None
);
787 /* if the window was reparented, do not reparent it back to the
789 wUnmanageWindow(wwin
, !reparented
, False
);
796 handleConfigureRequest(XEvent
*event
)
801 puts("got configure request");
803 if (!(wwin
=wWindowFor(event
->xconfigurerequest
.window
))) {
805 * Configure request for unmapped window
807 wClientConfigure(NULL
, &(event
->xconfigurerequest
));
809 wClientConfigure(wwin
, &(event
->xconfigurerequest
));
815 handlePropertyNotify(XEvent
*event
)
825 puts("got property notify");
827 if ((wwin
=wWindowFor(event
->xproperty
.window
))) {
828 if (!XGetGeometry(dpy
, wwin
->client_win
, &jr
, &ji
, &ji
,
829 &ju
, &ju
, &ju
, &ju
)) {
832 wClientCheckProperty(wwin
, &event
->xproperty
);
834 wapp
= wApplicationOf(event
->xproperty
.window
);
836 wClientCheckProperty(wapp
->main_window_desc
, &event
->xproperty
);
839 scr
= wScreenForWindow(event
->xproperty
.window
);
840 if (scr
&& scr
->root_win
== event
->xproperty
.window
) {
842 wKWMCheckRootHintChange(scr
, &event
->xproperty
);
849 handleClientMessage(XEvent
*event
)
852 WObjDescriptor
*desc
;
855 puts("got client message");
857 /* handle transition from Normal to Iconic state */
858 if (event
->xclient
.message_type
== _XA_WM_CHANGE_STATE
859 && event
->xclient
.format
== 32
860 && event
->xclient
.data
.l
[0] == IconicState
) {
862 wwin
= wWindowFor(event
->xclient
.window
);
864 if (!wwin
->flags
.miniaturized
)
865 wIconifyWindow(wwin
);
866 } else if (event
->xclient
.message_type
== _XA_WM_COLORMAP_NOTIFY
867 && event
->xclient
.format
== 32) {
868 WScreen
*scr
= wScreenSearchForRootWindow(event
->xclient
.window
);
873 if (event
->xclient
.data
.l
[1] == 1) { /* starting */
874 wColormapAllowClientInstallation(scr
, True
);
875 } else { /* stopping */
876 wColormapAllowClientInstallation(scr
, False
);
878 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_COMMAND
) {
880 wDefaultsCheckDomains("bla");
882 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_WM_FUNCTION
) {
885 wapp
= wApplicationOf(event
->xclient
.window
);
887 switch (event
->xclient
.data
.l
[0]) {
888 case WMFHideOtherApplications
:
889 wHideOtherApplications(wapp
->main_window_desc
);
893 case WMFHideApplication
:
894 wHideApplication(wapp
);
900 wwin
= wWindowFor(event
->xclient
.window
);
902 switch (event
->xclient
.data
.l
[0]) {
903 case WMFHideOtherApplications
:
904 wHideOtherApplications(wwin
);
907 case WMFHideApplication
:
908 wHideApplication(wApplicationOf(wwin
->main_window
));
914 } else if (wGNOMEProcessClientMessage(&event
->xclient
)) {
916 #endif /* GNOME_STUFF */
918 } else if (wKWMProcessClientMessage(&event
->xclient
)) {
920 #endif /* KWM_HINTS */
922 } else if (wXDNDProcessClientMessage(&event
->xclient
)) {
926 } else if (event
->xclient
.message_type
==_XA_DND_PROTOCOL
) {
927 WScreen
*scr
= wScreenForWindow(event
->xclient
.window
);
928 if (scr
&& wDockReceiveDNDDrop(scr
,event
))
929 goto redirect_message
;
930 #endif /* OFFIX_DND */
936 * Non-standard thing, but needed by OffiX DND.
937 * For when the icon frame gets a ClientMessage
938 * that should have gone to the icon_window.
940 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
941 (XPointer
*)&desc
)!=XCNOENT
) {
942 struct WIcon
*icon
=NULL
;
944 if (desc
->parent_type
== WCLASS_MINIWINDOW
) {
945 icon
= (WIcon
*)desc
->parent
;
946 } else if (desc
->parent_type
== WCLASS_DOCK_ICON
947 || desc
->parent_type
== WCLASS_APPICON
) {
948 icon
= ((WAppIcon
*)desc
->parent
)->icon
;
950 if (icon
&& (wwin
=icon
->owner
)) {
951 if (wwin
->client_win
!=event
->xclient
.window
) {
952 event
->xclient
.window
= wwin
->client_win
;
953 XSendEvent(dpy
, wwin
->client_win
, False
, NoEventMask
,
963 raiseWindow(WScreen
*scr
)
967 scr
->autoRaiseTimer
= NULL
;
969 wwin
= wWindowFor(scr
->autoRaiseWindow
);
973 if (!wwin
->flags
.destroyed
) {
974 wRaiseFrame(wwin
->frame
->core
);
975 /* this is needed or a race condition will occur */
982 handleEnterNotify(XEvent
*event
)
985 WObjDescriptor
*desc
= NULL
;
987 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
991 puts("got enter notify");
994 if (XCheckTypedWindowEvent(dpy
, event
->xcrossing
.window
, LeaveNotify
,
996 /* already left the window... */
998 if (ev
.xcrossing
.mode
==event
->xcrossing
.mode
999 && ev
.xcrossing
.detail
==event
->xcrossing
.detail
) {
1004 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1005 (XPointer
*)&desc
)!=XCNOENT
) {
1006 if(desc
->handle_enternotify
)
1007 (*desc
->handle_enternotify
)(desc
, event
);
1010 /* enter to window */
1011 wwin
= wWindowFor(event
->xcrossing
.window
);
1013 if (wPreferences
.focus_mode
==WKF_POINTER
1014 && event
->xcrossing
.window
==event
->xcrossing
.root
) {
1015 wSetFocusTo(scr
, NULL
);
1017 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1018 wColormapInstallForWindow(scr
, NULL
);
1020 if (scr
->autoRaiseTimer
1021 && event
->xcrossing
.root
==event
->xcrossing
.window
) {
1022 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1023 scr
->autoRaiseTimer
= NULL
;
1026 /* set auto raise timer even if in focus-follows-mouse mode
1027 * and the event is for the frame window, even if the window
1028 * has focus already. useful if you move the pointer from a focused
1029 * window to the root window and back pretty fast
1031 * set focus if in focus-follows-mouse mode and the event
1032 * is for the frame window and window doesn't have focus yet */
1033 if ((wPreferences
.focus_mode
==WKF_POINTER
1034 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1035 && wwin
->frame
->core
->window
==event
->xcrossing
.window
1036 && !scr
->flags
.doing_alt_tab
) {
1038 if (!wwin
->flags
.focused
&& !WFLAGP(wwin
, no_focusable
))
1039 wSetFocusTo(scr
, wwin
);
1041 if (scr
->autoRaiseTimer
)
1042 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1043 scr
->autoRaiseTimer
= NULL
;
1045 if (wPreferences
.raise_delay
&& !WFLAGP(wwin
, no_focusable
)) {
1046 scr
->autoRaiseWindow
= wwin
->frame
->core
->window
;
1048 = WMAddTimerHandler(wPreferences
.raise_delay
,
1049 (WMCallback
*)raiseWindow
, scr
);
1052 /* Install colormap for window, if the colormap installation mode
1053 * is colormap_follows_mouse */
1054 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1055 if (wwin
->client_win
==event
->xcrossing
.window
)
1056 wColormapInstallForWindow(scr
, wwin
);
1058 wColormapInstallForWindow(scr
, NULL
);
1062 /* a little kluge to hide the clip balloon */
1063 if (!wPreferences
.flags
.noclip
&& scr
->flags
.clip_balloon_mapped
) {
1065 XUnmapWindow(dpy
, scr
->clip_balloon
);
1066 scr
->flags
.clip_balloon_mapped
= 0;
1068 if (desc
->parent_type
!=WCLASS_DOCK_ICON
1069 || scr
->clip_icon
!= desc
->parent
) {
1070 XUnmapWindow(dpy
, scr
->clip_balloon
);
1071 scr
->flags
.clip_balloon_mapped
= 0;
1076 if (event
->xcrossing
.window
== event
->xcrossing
.root
1077 && event
->xcrossing
.detail
== NotifyNormal
1078 && event
->xcrossing
.detail
!= NotifyInferior
1079 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1081 wSetFocusTo(scr
, scr
->focused_window
);
1085 wBalloonEnteredObject(scr
, desc
);
1091 handleLeaveNotify(XEvent
*event
)
1093 WObjDescriptor
*desc
= NULL
;
1095 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1096 (XPointer
*)&desc
)!=XCNOENT
) {
1097 if(desc
->handle_leavenotify
)
1098 (*desc
->handle_leavenotify
)(desc
, event
);
1100 if (event
->xcrossing
.window
== event
->xcrossing
.root
1101 && event
->xcrossing
.mode
== NotifyNormal
1102 && event
->xcrossing
.detail
!= NotifyInferior
1103 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1105 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1107 wSetFocusTo(scr
, NULL
);
1114 handleShapeNotify(XEvent
*event
)
1116 XShapeEvent
*shev
= (XShapeEvent
*)event
;
1121 puts("got shape notify");
1124 while (XCheckTypedWindowEvent(dpy
, shev
->window
, event
->type
, &ev
)) {
1125 XShapeEvent
*sev
= (XShapeEvent
*)&ev
;
1127 if (sev
->kind
== ShapeBounding
) {
1128 if (sev
->shaped
== shev
->shaped
) {
1131 XPutBackEvent(dpy
, &ev
);
1137 wwin
= wWindowFor(shev
->window
);
1138 if (!wwin
|| shev
->kind
!= ShapeBounding
)
1141 if (!shev
->shaped
&& wwin
->flags
.shaped
) {
1143 wwin
->flags
.shaped
= 0;
1144 wWindowClearShape(wwin
);
1146 } else if (shev
->shaped
) {
1148 wwin
->flags
.shaped
= 1;
1149 wWindowSetShape(wwin
);
1154 #ifdef KEEP_XKB_LOCK_STATUS
1155 /* please help ]d if you know what to do */
1156 handleXkbIndicatorStateNotify(XEvent
*event
)
1160 XkbStateRec staterec
;
1163 for (i
=0; i
<wScreenCount
; i
++) {
1164 scr
= wScreenWithNumber(i
);
1165 wwin
= scr
->focused_window
;
1166 if (wwin
->flags
.focused
) {
1167 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1168 if (wwin
->frame
->languagemode
!= staterec
.group
) {
1169 wwin
->frame
->last_languagemode
= wwin
->frame
->languagemode
;
1170 wwin
->frame
->languagemode
= staterec
.group
;
1172 #ifdef XKB_BUTTON_HINT
1173 if (wwin
->frame
->titlebar
) {
1174 wFrameWindowPaint(wwin
->frame
);
1180 #endif /*KEEP_XKB_LOCK_STATUS*/
1183 handleColormapNotify(XEvent
*event
)
1187 Bool reinstall
= False
;
1189 wwin
= wWindowFor(event
->xcolormap
.window
);
1193 scr
= wwin
->screen_ptr
;
1197 if (event
->xcolormap
.new) {
1198 XWindowAttributes attr
;
1200 XGetWindowAttributes(dpy
, wwin
->client_win
, &attr
);
1202 if (wwin
== scr
->cmap_window
&& wwin
->cmap_window_no
== 0)
1203 scr
->current_colormap
= attr
.colormap
;
1206 } else if (event
->xcolormap
.state
== ColormapUninstalled
&&
1207 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1209 /* some bastard app (like XV) removed our colormap */
1211 * can't enforce or things like xscreensaver wont work
1214 } else if (event
->xcolormap
.state
== ColormapInstalled
&&
1215 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1217 /* someone has put our colormap back */
1221 } while (XCheckTypedEvent(dpy
, ColormapNotify
, event
)
1222 && ((wwin
= wWindowFor(event
->xcolormap
.window
)) || 1));
1224 if (reinstall
&& scr
->current_colormap
!=None
) {
1225 if (!scr
->flags
.colormap_stuff_blocked
)
1226 XInstallColormap(dpy
, scr
->current_colormap
);
1233 handleFocusIn(XEvent
*event
)
1238 * For applications that like stealing the focus.
1240 while (XCheckTypedEvent(dpy
, FocusIn
, event
));
1241 saveTimestamp(event
);
1242 if (event
->xfocus
.mode
== NotifyUngrab
1243 || event
->xfocus
.mode
== NotifyGrab
1244 || event
->xfocus
.detail
> NotifyNonlinearVirtual
) {
1248 wwin
= wWindowFor(event
->xfocus
.window
);
1249 if (wwin
&& !wwin
->flags
.focused
) {
1250 if (wwin
->flags
.mapped
)
1251 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1253 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1255 WScreen
*scr
= wScreenForWindow(event
->xfocus
.window
);
1257 wSetFocusTo(scr
, NULL
);
1263 windowUnderPointer(WScreen
*scr
)
1269 if (XQueryPointer(dpy
, scr
->root_win
, &bar
, &win
, &foo
, &foo
, &foo
, &foo
,
1271 return wWindowFor(win
);
1275 #ifdef WEENDOZE_CYCLE
1278 nextToFocusAfter(WWindow
*wwin
)
1280 WWindow
*tmp
= wwin
->prev
;
1283 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1291 /* start over from the beginning of the list */
1295 while (tmp
&& tmp
!= wwin
) {
1296 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1308 nextToFocusBefore(WWindow
*wwin
)
1310 WWindow
*tmp
= wwin
->next
;
1313 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1320 /* start over from the beginning of the list */
1325 while (tmp
&& tmp
!= wwin
) {
1326 if (wWindowCanReceiveFocus(tmp
) && !WFLAGP(tmp
, skip_window_list
)) {
1337 doWindozeCycle(WWindow
*wwin
, XEvent
*event
, Bool next
)
1339 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1341 Bool openedSwitchMenu
= False
;
1342 WWindow
*newFocused
;
1343 WWindow
*oldFocused
;
1345 XModifierKeymap
*keymap
;
1351 keymap
= XGetModifierMapping(dpy
);
1354 XGrabKeyboard(dpy
, scr
->root_win
, False
, GrabModeAsync
, GrabModeAsync
,
1358 newFocused
= nextToFocusAfter(wwin
);
1360 newFocused
= nextToFocusBefore(wwin
);
1363 scr
->flags
.doing_alt_tab
= 1;
1365 wWindowFocus(newFocused
, scr
->focused_window
);
1366 oldFocused
= newFocused
;
1367 if (wPreferences
.circ_raise
)
1368 wRaiseFrame(newFocused
->frame
->core
);
1370 if (wPreferences
.popup_switchmenu
&&
1371 (!scr
->switch_menu
|| !scr
->switch_menu
->flags
.mapped
)) {
1373 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, False
);
1374 openedSwitchMenu
= True
;
1380 WMMaskEvent(dpy
,KeyPressMask
|KeyReleaseMask
|ExposureMask
, &ev
);
1381 /* WMNextEvent(dpy, &ev);*/
1382 if (ev
.type
!= KeyRelease
&& ev
.type
!= KeyPress
) {
1387 /* ignore CapsLock */
1388 modifiers
= ev
.xkey
.state
& ValidModMask
;
1390 if (ev
.type
== KeyPress
1391 && wKeyBindings
[WKBD_FOCUSNEXT
].keycode
== ev
.xkey
.keycode
1392 && wKeyBindings
[WKBD_FOCUSNEXT
].modifier
== modifiers
) {
1394 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1395 newFocused
= nextToFocusAfter(newFocused
);
1396 wWindowFocus(newFocused
, oldFocused
);
1397 oldFocused
= newFocused
;
1398 if (wPreferences
.circ_raise
)
1399 wRaiseFrame(newFocused
->frame
->core
);
1400 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1402 } else if (ev
.type
== KeyPress
1403 && wKeyBindings
[WKBD_FOCUSPREV
].keycode
== ev
.xkey
.keycode
1404 && wKeyBindings
[WKBD_FOCUSPREV
].modifier
== modifiers
) {
1406 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1407 newFocused
= nextToFocusBefore(newFocused
);
1408 wWindowFocus(newFocused
, oldFocused
);
1409 oldFocused
= newFocused
;
1410 if (wPreferences
.circ_raise
)
1411 wRaiseFrame(newFocused
->frame
->core
);
1412 UpdateSwitchMenu(scr
, newFocused
, ACTION_CHANGE_STATE
);
1414 if (ev
.type
== KeyRelease
) {
1417 for (i
= 0; i
<= 8 * keymap
->max_keypermod
; i
++) {
1418 if (keymap
->modifiermap
[i
] == ev
.xkey
.keycode
&&
1419 wKeyBindings
[WKBD_FOCUSNEXT
].modifier
1420 & 1<<(i
/keymap
->max_keypermod
)) {
1430 XUngrabKeyboard(dpy
, CurrentTime
);
1431 wSetFocusTo(scr
, newFocused
);
1432 scr
->flags
.doing_alt_tab
= 0;
1433 if (openedSwitchMenu
)
1434 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, False
);
1438 #endif /* WEENDOZE_CYCLE */
1444 handleKeyPress(XEvent
*event
)
1446 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1447 WWindow
*wwin
= scr
->focused_window
;
1451 #ifdef KEEP_XKB_LOCK_STATUS
1452 XkbStateRec staterec
;
1453 #endif /*KEEP_XKB_LOCK_STATUS*/
1455 /* ignore CapsLock */
1456 modifiers
= event
->xkey
.state
& ValidModMask
;
1458 for (i
=0; i
<WKBD_LAST
; i
++) {
1459 if (wKeyBindings
[i
].keycode
==0)
1462 if (wKeyBindings
[i
].keycode
==event
->xkey
.keycode
1463 && (/*wKeyBindings[i].modifier==0
1464 ||*/ wKeyBindings
[i
].modifier
==modifiers
)) {
1477 if (!wRootMenuPerformShortcut(event
)) {
1479 static int dontLoop
= 0;
1481 if (dontLoop
> 10) {
1482 wwarning("problem with key event processing code");
1486 /* if the focused window is an internal window, try redispatching
1487 * the event to the managed window, as it can be a WINGs window */
1488 if (wwin
&& wwin
->flags
.internal_window
1489 && wwin
->client_leader
!=None
) {
1490 /* client_leader contains the WINGs toplevel */
1491 event
->xany
.window
= wwin
->client_leader
;
1492 WMHandleEvent(event
);
1499 #define ISMAPPED(w) ((w) && !(w)->flags.miniaturized && ((w)->flags.mapped || (w)->flags.shaded))
1500 #define ISFOCUSED(w) ((w) && (w)->flags.focused)
1505 OpenRootMenu(scr
, event
->xkey
.x_root
, event
->xkey
.y_root
, True
);
1507 case WKBD_WINDOWLIST
:
1508 OpenSwitchMenu(scr
, event
->xkey
.x_root
, event
->xkey
.y_root
, True
);
1511 case WKBD_WINDOWMENU
:
1512 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
))
1513 OpenWindowMenu(wwin
, wwin
->frame_x
,
1514 wwin
->frame_y
+wwin
->frame
->top_width
, True
);
1516 case WKBD_MINIATURIZE
:
1517 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)
1518 && !WFLAGP(wwin
, no_miniaturizable
)) {
1519 CloseWindowMenu(scr
);
1521 if (wwin
->protocols
.MINIATURIZE_WINDOW
)
1522 wClientSendProtocol(wwin
, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
,
1523 event
->xbutton
.time
);
1525 wIconifyWindow(wwin
);
1530 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1531 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1532 CloseWindowMenu(scr
);
1534 if (wapp
&& !WFLAGP(wapp
->main_window_desc
, no_appicon
)) {
1535 wHideApplication(wapp
);
1540 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1541 CloseWindowMenu(scr
);
1543 if (wwin
->flags
.maximized
) {
1544 wUnmaximizeWindow(wwin
);
1546 wMaximizeWindow(wwin
, MAX_VERTICAL
|MAX_HORIZONTAL
);
1550 case WKBD_VMAXIMIZE
:
1551 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1552 CloseWindowMenu(scr
);
1554 if (wwin
->flags
.maximized
) {
1555 wUnmaximizeWindow(wwin
);
1557 wMaximizeWindow(wwin
, MAX_VERTICAL
);
1562 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1563 CloseWindowMenu(scr
);
1565 wRaiseFrame(wwin
->frame
->core
);
1569 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1570 CloseWindowMenu(scr
);
1572 wLowerFrame(wwin
->frame
->core
);
1575 case WKBD_RAISELOWER
:
1576 /* raise or lower the window under the pointer, not the
1579 wwin
= windowUnderPointer(scr
);
1581 wRaiseLowerFrame(wwin
->frame
->core
);
1584 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_shadeable
)) {
1585 if (wwin
->flags
.shaded
)
1586 wUnshadeWindow(wwin
);
1591 case WKBD_MOVERESIZE
:
1592 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1593 CloseWindowMenu(scr
);
1595 wKeyboardMoveResizeWindow(wwin
);
1599 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_closable
)) {
1600 CloseWindowMenu(scr
);
1601 if (wwin
->protocols
.DELETE_WINDOW
)
1602 wClientSendProtocol(wwin
, _XA_WM_DELETE_WINDOW
,
1607 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1608 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1611 case WKBD_FOCUSNEXT
:
1612 #ifdef WEENDOZE_CYCLE
1613 if (wPreferences
.windoze_cycling
) {
1614 doWindozeCycle(wwin
, event
, True
);
1616 #endif /* WEENDOZE_CYCLE */
1618 wwin
= NextFocusWindow(scr
);
1620 wSetFocusTo(scr
, wwin
);
1621 if (wPreferences
.circ_raise
)
1622 wRaiseFrame(wwin
->frame
->core
);
1627 case WKBD_FOCUSPREV
:
1628 #ifdef WEENDOZE_CYCLE
1629 if (wPreferences
.windoze_cycling
) {
1630 doWindozeCycle(wwin
, event
, False
);
1632 #endif /* WEENDOZE_CYCLE */
1634 wwin
= PrevFocusWindow(scr
);
1636 wSetFocusTo(scr
, wwin
);
1637 if (wPreferences
.circ_raise
)
1638 wRaiseFrame(wwin
->frame
->core
);
1643 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
1644 #define GOTOWORKS(wk) case WKBD_WORKSPACE##wk:\
1645 i = (scr->current_workspace/10)*10 + wk - 1;\
1646 if (wPreferences.ws_advance || i<scr->workspace_count)\
1647 wWorkspaceChange(scr, i);\
1650 #define GOTOWORKS(wk) case WKBD_WORKSPACE/**/wk:\
1651 i = (scr->current_workspace/10)*10 + wk - 1;\
1652 if (wPreferences.ws_advance || i<scr->workspace_count)\
1653 wWorkspaceChange(scr, i);\
1667 case WKBD_NEXTWORKSPACE
:
1668 wWorkspaceRelativeChange(scr
, 1);
1670 case WKBD_PREVWORKSPACE
:
1671 wWorkspaceRelativeChange(scr
, -1);
1677 #ifdef EXTEND_WINDOWSHORTCUT
1685 if ( scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]) {
1686 LinkedList
*list
= scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
];
1689 wUnselectWindows(scr
);
1690 if (scr
->shortcutWindow
[command
-WKBD_WINDOW1
])
1691 wMakeWindowVisible(scr
->shortcutWindow
[command
-WKBD_WINDOW1
]);
1692 cw
= scr
->current_workspace
;
1694 wWindowChangeWorkspace(list
->head
, cw
);
1695 wMakeWindowVisible(list
->head
);
1696 wSelectWindow(list
->head
, True
);
1699 } else if (scr
->shortcutWindow
[command
-WKBD_WINDOW1
]){
1701 wMakeWindowVisible(scr
->shortcutWindow
[command
-WKBD_WINDOW1
]);
1703 } else if (wwin
&& ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1705 scr
->shortcutWindow
[command
-WKBD_WINDOW1
] = wwin
;
1706 if (wwin
->flags
.selected
/* && scr->selected_windows */ ) {
1709 sl
= scr
->selected_windows
;
1710 list_free(scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1713 scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
] = list_cons(sl
->head
,scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1717 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1720 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1723 } else if (scr
->selected_windows
) {
1725 if (wwin
->flags
.selected
/* && scr->selected_windows */ ) {
1728 sl
= scr
->selected_windows
;
1729 list_free(scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1732 scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
] = list_cons(sl
->head
,scr
->shortcutSelectedWindows
[command
-WKBD_WINDOW1
]);
1739 case WKBD_NEXTWSLAYER
:
1740 case WKBD_PREVWSLAYER
:
1744 row
= scr
->current_workspace
/10;
1745 column
= scr
->current_workspace
%10;
1747 if (command
==WKBD_NEXTWSLAYER
) {
1748 if ((row
+1)*10 < scr
->workspace_count
)
1749 wWorkspaceChange(scr
, column
+(row
+1)*10);
1752 wWorkspaceChange(scr
, column
+(row
-1)*10);
1756 case WKBD_CLIPLOWER
:
1757 if (!wPreferences
.flags
.noclip
)
1758 wDockLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1760 case WKBD_CLIPRAISE
:
1761 if (!wPreferences
.flags
.noclip
)
1762 wDockRaise(scr
->workspaces
[scr
->current_workspace
]->clip
);
1764 case WKBD_CLIPRAISELOWER
:
1765 if (!wPreferences
.flags
.noclip
)
1766 wDockRaiseLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1768 #ifdef KEEP_XKB_LOCK_STATUS
1770 if(wPreferences
.modelock
) {
1772 wwin
= scr
->focused_window
;
1774 if (wwin
&& wwin
->flags
.mapped
1775 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
1776 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
) {
1777 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1779 wwin
->frame
->languagemode
= wwin
->frame
->last_languagemode
;
1780 wwin
->frame
->last_languagemode
= staterec
.group
;
1781 XkbLockGroup(dpy
,XkbUseCoreKbd
, wwin
->frame
->languagemode
);
1786 #endif /* KEEP_XKB_LOCK_STATUS */
1793 handleMotionNotify(XEvent
*event
)
1796 WScreen
*scr
= wScreenForRootWindow(event
->xmotion
.root
);
1798 if (wPreferences
.scrollable_menus
) {
1799 if (scr
->flags
.jump_back_pending
||
1800 event
->xmotion
.x_root
<= 1 ||
1801 event
->xmotion
.x_root
>= (scr
->scr_width
- 2) ||
1802 event
->xmotion
.y_root
<= 1 ||
1803 event
->xmotion
.y_root
>= (scr
->scr_height
- 2)) {
1806 puts("pointer at screen edge");
1809 menu
= wMenuUnderPointer(scr
);
1811 wMenuScroll(menu
, event
);
1815 if (event
->xmotion
.subwindow
== None
)
1818 if (scr
->scrolledFMaximize
!= None
) {
1821 twin
= wWindowFor(scr
->scrolledFMaximize
);
1822 if (twin
&& twin
->frame_y
==) {
1826 scr
->scrolledFMaximize
= NULL
;
1830 /* scroll full maximized window */
1831 if (event
->xmotion
.y_root
< 1
1832 || event
->xmotion
.y_root
> scr
->scr_height
- 1) {
1834 wwin
= wWindowFor(event
->xmotion
.subwindow
);
1836 if (wwin
&& (wwin
->flags
.maximized
& MAX_VERTICAL
)
1837 && WFLAGP(wwin
, full_maximize
)
1838 && event
->xmotion
.x_root
>= wwin
->frame_x
1839 && event
->xmotion
.x_root
<= wwin
->frame_x
+ wwin
->frame
->core
->width
) {
1841 if (!WFLAGP(wwin
, no_titlebar
)
1842 && wwin
->frame_y
<= - wwin
->frame
->top_width
) {
1844 wWindowMove(wwin
, wwin
->frame_x
, 0);
1845 wwin
->flags
.dragged_while_fmaximized
= 0;
1847 } else if (!WFLAGP(wwin
, no_resizebar
)
1848 && wwin
->frame_y
+ wwin
->frame
->core
->height
>=
1849 scr
->scr_height
+ wwin
->frame
->bottom_width
) {
1851 int y
= scr
->scr_height
+ wwin
->frame
->bottom_width
;
1853 y
= scr
->scr_height
- wwin
->frame_y
- wwin
->frame
->core
->height
;
1855 wWindowMove(wwin
, wwin
->frame_x
, y
);
1856 wwin
->flags
.dragged_while_fmaximized
= 0;
1865 handleVisibilityNotify(XEvent
*event
)
1869 wwin
= wWindowFor(event
->xvisibility
.window
);
1872 wwin
->flags
.obscured
=
1873 (event
->xvisibility
.state
== VisibilityFullyObscured
);