1 /* event.c- event loop and handling
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 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,
35 #include <X11/Xutil.h>
37 # include <X11/extensions/shape.h>
43 #ifdef KEEP_XKB_LOCK_STATUS
44 #include <X11/XKBlib.h>
45 #endif /* KEEP_XKB_LOCK_STATUS */
47 #include "WindowMaker.h"
53 #include "application.h"
56 #include "workspace.h"
59 #include "properties.h"
73 /******** Global Variables **********/
74 extern XContext wWinContext
;
75 extern XContext wVEdgeContext
;
77 extern Cursor wCursor
[WCUR_LAST
];
79 extern WShortKey wKeyBindings
[WKBD_LAST
];
80 extern int wScreenCount
;
81 extern Time LastTimestamp
;
82 extern Time LastFocusChange
;
84 extern WPreferences wPreferences
;
86 #define MOD_MASK wPreferences.modifier_mask
88 extern Atom _XA_WM_COLORMAP_NOTIFY
;
90 extern Atom _XA_WM_CHANGE_STATE
;
91 extern Atom _XA_WM_DELETE_WINDOW
;
92 extern Atom _XA_GNUSTEP_WM_ATTR
;
93 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
;
94 extern Atom _XA_GNUSTEP_TITLEBAR_STATE
;
95 extern Atom _XA_WINDOWMAKER_WM_FUNCTION
;
96 extern Atom _XA_WINDOWMAKER_COMMAND
;
99 extern Atom _XA_DND_PROTOCOL
;
104 extern Bool wShapeSupported
;
105 extern int wShapeEventBase
;
108 #ifdef KEEP_XKB_LOCK_STATUS
109 extern int wXkbEventBase
;
113 extern char WDelayedActionSet
;
116 /************ Local stuff ***********/
119 static void saveTimestamp(XEvent
*event
);
120 static void handleColormapNotify();
121 static void handleMapNotify();
122 static void handleUnmapNotify();
123 static void handleButtonPress();
124 static void handleExpose();
125 static void handleDestroyNotify();
126 static void handleConfigureRequest();
127 static void handleMapRequest();
128 static void handlePropertyNotify();
129 static void handleEnterNotify();
130 static void handleLeaveNotify();
131 static void handleExtensions();
132 static void handleClientMessage();
133 static void handleKeyPress();
134 static void handleFocusIn();
135 static void handleMotionNotify();
136 static void handleVisibilityNotify();
140 static void handleShapeNotify();
143 /* called from the signal handler */
144 void NotifyDeadProcess(pid_t pid
, unsigned char status
);
146 /* real dead process handler */
147 static void handleDeadProcess(void *foo
);
150 typedef struct DeadProcesses
{
152 unsigned char exit_status
;
155 /* stack of dead processes */
156 static DeadProcesses deadProcesses
[MAX_DEAD_PROCESSES
];
157 static int deadProcessPtr
=0;
160 typedef struct DeathHandler
{
161 WDeathHandler
*callback
;
166 static WMArray
*deathHandlers
=NULL
;
171 wAddDeathHandler(pid_t pid
, WDeathHandler
*callback
, void *cdata
)
173 DeathHandler
*handler
;
175 handler
= malloc(sizeof(DeathHandler
));
180 handler
->callback
= callback
;
181 handler
->client_data
= cdata
;
184 deathHandlers
= WMCreateArrayWithDestructor(8, wfree
);
186 WMAddToArray(deathHandlers
, handler
);
194 wDeleteDeathHandler(WMagicNumber id
)
196 DeathHandler
*handler
=(DeathHandler
*)id
;
198 if (!handler
|| !deathHandlers
)
201 /* array destructor will call wfree(handler) */
202 WMRemoveFromArray(deathHandlers
, handler
);
207 DispatchEvent(XEvent
*event
)
210 handleDeadProcess(NULL
);
212 if (WCHECK_STATE(WSTATE_NEED_EXIT
)) {
213 WCHANGE_STATE(WSTATE_EXITING
);
214 /* received SIGTERM */
216 * WMHandleEvent() can't be called from anything
217 * executed inside here, or we can get in a infinite
220 Shutdown(WSExitMode
);
222 } else if (WCHECK_STATE(WSTATE_NEED_RESTART
)) {
223 WCHANGE_STATE(WSTATE_RESTARTING
);
225 Shutdown(WSRestartPreparationMode
);
226 /* received SIGHUP */
228 } else if (WCHECK_STATE(WSTATE_NEED_REREAD
)) {
229 WCHANGE_STATE(WSTATE_NORMAL
);
230 wDefaultsCheckDomains("bla");
233 /* for the case that all that is wanted to be dispatched is
238 saveTimestamp(event
);
239 switch (event
->type
) {
241 handleMapRequest(event
);
245 handleKeyPress(event
);
249 handleMotionNotify(event
);
252 case ConfigureRequest
:
253 handleConfigureRequest(event
);
257 handleDestroyNotify(event
);
261 handleMapNotify(event
);
265 handleUnmapNotify(event
);
269 handleButtonPress(event
);
277 handlePropertyNotify(event
);
281 handleEnterNotify(event
);
285 handleLeaveNotify(event
);
289 handleClientMessage(event
);
293 handleColormapNotify(event
);
297 if (event
->xmapping
.request
== MappingKeyboard
298 || event
->xmapping
.request
== MappingModifier
)
299 XRefreshKeyboardMapping(&event
->xmapping
);
303 handleFocusIn(event
);
306 case VisibilityNotify
:
307 handleVisibilityNotify(event
);
310 handleExtensions(event
);
317 *----------------------------------------------------------------------
319 * Processes X and internal events indefinitely.
325 * The LastTimestamp global variable is updated.
326 *----------------------------------------------------------------------
334 WMNextEvent(dpy
, &event
);
335 WMHandleEvent(&event
);
341 *----------------------------------------------------------------------
342 * ProcessPendingEvents --
343 * Processes the events that are currently pending (at the time
344 * this function is called) in the display's queue.
347 * After the pending events that were present at the function call
351 * Many -- whatever handling events may involve.
353 *----------------------------------------------------------------------
356 ProcessPendingEvents()
363 /* Take a snapshot of the event count in the queue */
364 count
= XPending(dpy
);
366 while (count
>0 && XPending(dpy
)) {
367 WMNextEvent(dpy
, &event
);
368 WMHandleEvent(&event
);
375 IsDoubleClick(WScreen
*scr
, XEvent
*event
)
377 if ((scr
->last_click_time
>0) &&
378 (event
->xbutton
.time
-scr
->last_click_time
<=wPreferences
.dblclick_time
)
379 && (event
->xbutton
.button
== scr
->last_click_button
)
380 && (event
->xbutton
.window
== scr
->last_click_window
)) {
382 scr
->flags
.next_click_is_not_double
= 1;
383 scr
->last_click_time
= 0;
384 scr
->last_click_window
= event
->xbutton
.window
;
393 NotifyDeadProcess(pid_t pid
, unsigned char status
)
395 if (deadProcessPtr
>=MAX_DEAD_PROCESSES
-1) {
396 wwarning("stack overflow: too many dead processes");
399 /* stack the process to be handled later,
400 * as this is called from the signal handler */
401 deadProcesses
[deadProcessPtr
].pid
= pid
;
402 deadProcesses
[deadProcessPtr
].exit_status
= status
;
408 handleDeadProcess(void *foo
)
413 for (i
=0; i
<deadProcessPtr
; i
++) {
414 wWindowDeleteSavedStatesForPID(deadProcesses
[i
].pid
);
417 if (!deathHandlers
) {
422 /* get the pids on the queue and call handlers */
423 while (deadProcessPtr
>0) {
426 for (i
= WMGetArrayItemCount(deathHandlers
)-1; i
>= 0; i
--) {
427 tmp
= WMGetFromArray(deathHandlers
, i
);
431 if (tmp
->pid
== deadProcesses
[deadProcessPtr
].pid
) {
432 (*tmp
->callback
)(tmp
->pid
,
433 deadProcesses
[deadProcessPtr
].exit_status
,
435 wDeleteDeathHandler(tmp
);
443 saveTimestamp(XEvent
*event
)
446 * Never save CurrentTime as LastTimestamp because CurrentTime
447 * it's not a real timestamp (it's the 0L constant)
450 switch (event
->type
) {
453 LastTimestamp
= event
->xbutton
.time
;
457 LastTimestamp
= event
->xkey
.time
;
460 LastTimestamp
= event
->xmotion
.time
;
463 LastTimestamp
= event
->xproperty
.time
;
467 LastTimestamp
= event
->xcrossing
.time
;
470 LastTimestamp
= event
->xselectionclear
.time
;
472 case SelectionRequest
:
473 LastTimestamp
= event
->xselectionrequest
.time
;
475 case SelectionNotify
:
476 LastTimestamp
= event
->xselection
.time
;
478 wXDNDProcessSelection(event
);
486 matchWindow(void *item
, void *cdata
)
488 return (((WFakeGroupLeader
*)item
)->origLeader
== (Window
)cdata
);
493 handleExtensions(XEvent
*event
)
495 #ifdef KEEP_XKB_LOCK_STATUS
497 xkbevent
= (XkbEvent
*)event
;
498 #endif /*KEEP_XKB_LOCK_STATUS*/
500 if (wShapeSupported
&& event
->type
== (wShapeEventBase
+ShapeNotify
)) {
501 handleShapeNotify(event
);
504 #ifdef KEEP_XKB_LOCK_STATUS
505 if (wPreferences
.modelock
&& (xkbevent
->type
== wXkbEventBase
)){
506 handleXkbIndicatorStateNotify(event
);
508 #endif /*KEEP_XKB_LOCK_STATUS*/
513 handleMapRequest(XEvent
*ev
)
517 Window window
= ev
->xmaprequest
.window
;
520 printf("got map request for %x\n", (unsigned)window
);
522 if ((wwin
= wWindowFor(window
))) {
523 if (wwin
->flags
.shaded
) {
524 wUnshadeWindow(wwin
);
526 /* deiconify window */
527 if (wwin
->flags
.miniaturized
) {
528 wDeiconifyWindow(wwin
);
529 } else if (wwin
->flags
.hidden
) {
530 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
531 /* go to the last workspace that the user worked on the app */
533 wWorkspaceChange(wwin
->screen_ptr
, wapp
->last_workspace
);
535 wUnhideApplication(wapp
, False
, False
);
540 scr
= wScreenForRootWindow(ev
->xmaprequest
.parent
);
542 wwin
= wManageWindow(scr
, window
);
545 * This is to let the Dock know that the application it launched
546 * has already been mapped (eg: it has finished launching).
547 * It is not necessary for normally docked apps, but is needed for
548 * apps that were forcedly docked (like with dockit).
550 if (scr
->last_dock
) {
551 if (wwin
&& wwin
->main_window
!=None
&& wwin
->main_window
!=window
)
552 wDockTrackWindowLaunch(scr
->last_dock
, wwin
->main_window
);
554 wDockTrackWindowLaunch(scr
->last_dock
, window
);
558 wClientSetState(wwin
, NormalState
, None
);
559 if (wwin
->flags
.maximized
) {
560 wMaximizeWindow(wwin
, wwin
->flags
.maximized
);
562 if (wwin
->flags
.shaded
) {
563 wwin
->flags
.shaded
= 0;
564 wwin
->flags
.skip_next_animation
= 1;
567 if (wwin
->flags
.miniaturized
) {
568 wwin
->flags
.miniaturized
= 0;
569 wwin
->flags
.skip_next_animation
= 1;
570 wIconifyWindow(wwin
);
572 if (wwin
->flags
.hidden
) {
573 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
575 wwin
->flags
.hidden
= 0;
576 wwin
->flags
.skip_next_animation
= 1;
578 wHideApplication(wapp
);
586 handleDestroyNotify(XEvent
*event
)
590 Window window
= event
->xdestroywindow
.window
;
591 WScreen
*scr
= wScreenForRootWindow(event
->xdestroywindow
.event
);
595 printf("got destroy notify\n");
597 wwin
= wWindowFor(window
);
599 wUnmanageWindow(wwin
, False
, True
);
603 while ((index
= WMFindInArray(scr
->fakeGroupLeaders
, matchWindow
,
604 (void*)window
)) != WANotFound
) {
605 WFakeGroupLeader
*fPtr
;
607 fPtr
= WMGetFromArray(scr
->fakeGroupLeaders
, index
);
608 if (fPtr
->retainCount
> 0) {
610 if (fPtr
->retainCount
==0 && fPtr
->leader
!=None
) {
611 XDestroyWindow(dpy
, fPtr
->leader
);
616 fPtr
->origLeader
= None
;
620 app
= wApplicationOf(window
);
622 if (window
== app
->main_window
) {
624 wwin
= app
->main_window_desc
->screen_ptr
->focused_window
;
626 if (wwin
->main_window
== window
) {
627 wwin
->main_window
= None
;
632 wApplicationDestroy(app
);
636 wKWMCheckDestroy(&event
->xdestroywindow
);
643 handleExpose(XEvent
*event
)
645 WObjDescriptor
*desc
;
649 printf("got expose\n");
651 while (XCheckTypedWindowEvent(dpy
, event
->xexpose
.window
, Expose
, &ev
));
653 if (XFindContext(dpy
, event
->xexpose
.window
, wWinContext
,
654 (XPointer
*)&desc
)==XCNOENT
) {
658 if (desc
->handle_expose
) {
659 (*desc
->handle_expose
)(desc
, event
);
664 executeButtonAction(WScreen
*scr
, XEvent
*event
, int action
)
667 case WA_SELECT_WINDOWS
:
668 wUnselectWindows(scr
);
669 wSelectWindows(scr
, event
);
671 case WA_OPEN_APPMENU
:
672 OpenRootMenu(scr
, event
->xbutton
.x_root
, event
->xbutton
.y_root
, False
);
674 if (scr
->root_menu
) {
675 if (scr
->root_menu
->brother
->flags
.mapped
)
676 event
->xbutton
.window
= scr
->root_menu
->brother
->frame
->core
->window
;
678 event
->xbutton
.window
= scr
->root_menu
->frame
->core
->window
;
681 case WA_OPEN_WINLISTMENU
:
682 OpenSwitchMenu(scr
, event
->xbutton
.x_root
, event
->xbutton
.y_root
, False
);
683 if (scr
->switch_menu
) {
684 if (scr
->switch_menu
->brother
->flags
.mapped
)
685 event
->xbutton
.window
= scr
->switch_menu
->brother
->frame
->core
->window
;
687 event
->xbutton
.window
= scr
->switch_menu
->frame
->core
->window
;
698 handleButtonPress(XEvent
*event
)
700 WObjDescriptor
*desc
;
704 printf("got button press\n");
706 scr
= wScreenForRootWindow(event
->xbutton
.root
);
714 if (event
->xbutton
.window
==scr
->root_win
) {
715 if (event
->xbutton
.button
==Button1
&&
716 wPreferences
.mouse_button1
!=WA_NONE
) {
717 executeButtonAction(scr
, event
, wPreferences
.mouse_button1
);
718 } else if (event
->xbutton
.button
==Button2
&&
719 wPreferences
.mouse_button2
!=WA_NONE
) {
720 executeButtonAction(scr
, event
, wPreferences
.mouse_button2
);
721 } else if (event
->xbutton
.button
==Button3
&&
722 wPreferences
.mouse_button3
!=WA_NONE
) {
723 executeButtonAction(scr
, event
, wPreferences
.mouse_button3
);
724 } else if (event
->xbutton
.button
==Button4
&&
725 wPreferences
.mouse_wheel
!=WA_NONE
) {
726 wWorkspaceRelativeChange(scr
, 1);
727 } else if (event
->xbutton
.button
==Button5
&&
728 wPreferences
.mouse_wheel
!=WA_NONE
) {
729 wWorkspaceRelativeChange(scr
, -1);
732 else if (wGNOMEProxyizeButtonEvent(scr
, event
))
739 if (XFindContext(dpy
, event
->xbutton
.subwindow
, wWinContext
,
740 (XPointer
*)&desc
)==XCNOENT
) {
741 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
742 (XPointer
*)&desc
)==XCNOENT
) {
747 if (desc
->parent_type
== WCLASS_WINDOW
) {
750 if (event
->xbutton
.state
& MOD_MASK
) {
751 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
754 /* if (wPreferences.focus_mode == WKF_CLICK) {*/
755 if (wPreferences
.ignore_focus_click
) {
756 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
758 XAllowEvents(dpy
, ReplayPointer
, CurrentTime
);
761 } else if (desc
->parent_type
== WCLASS_APPICON
762 || desc
->parent_type
== WCLASS_MINIWINDOW
763 || desc
->parent_type
== WCLASS_DOCK_ICON
) {
764 if (event
->xbutton
.state
& MOD_MASK
) {
766 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
771 if (desc
->handle_mousedown
!=NULL
) {
772 (*desc
->handle_mousedown
)(desc
, event
);
775 /* save double-click information */
776 if (scr
->flags
.next_click_is_not_double
) {
777 scr
->flags
.next_click_is_not_double
= 0;
779 scr
->last_click_time
= event
->xbutton
.time
;
780 scr
->last_click_button
= event
->xbutton
.button
;
781 scr
->last_click_window
= event
->xbutton
.window
;
787 handleMapNotify(XEvent
*event
)
793 wwin
= wWindowFor(event
->xmap
.event
);
794 if (wwin
&& wwin
->client_win
== event
->xmap
.event
) {
795 if (wwin
->flags
.miniaturized
) {
796 wDeiconifyWindow(wwin
);
800 wClientSetState(wwin
, NormalState
, None
);
808 handleUnmapNotify(XEvent
*event
)
812 Bool withdraw
= False
;
814 printf("got unmap\n");
816 /* only process windows with StructureNotify selected
817 * (ignore SubstructureNotify) */
818 wwin
= wWindowFor(event
->xunmap
.window
);
822 /* whether the event is a Withdrawal request */
823 if (event
->xunmap
.event
== wwin
->screen_ptr
->root_win
824 && event
->xunmap
.send_event
)
827 if (wwin
->client_win
!= event
->xunmap
.event
&& !withdraw
)
830 if (!wwin
->flags
.mapped
&& !withdraw
831 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
832 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
)
836 XUnmapWindow(dpy
, wwin
->frame
->core
->window
);
837 wwin
->flags
.mapped
= 0;
839 /* check if the window was destroyed */
840 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, DestroyNotify
,&ev
)) {
843 Bool reparented
= False
;
845 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, ReparentNotify
, &ev
))
848 /* withdraw window */
849 wwin
->flags
.mapped
= 0;
851 wClientSetState(wwin
, WithdrawnState
, None
);
853 /* if the window was reparented, do not reparent it back to the
855 wUnmanageWindow(wwin
, !reparented
, False
);
862 handleConfigureRequest(XEvent
*event
)
866 printf("got configure request\n");
868 if (!(wwin
=wWindowFor(event
->xconfigurerequest
.window
))) {
870 * Configure request for unmapped window
872 wClientConfigure(NULL
, &(event
->xconfigurerequest
));
874 wClientConfigure(wwin
, &(event
->xconfigurerequest
));
880 handlePropertyNotify(XEvent
*event
)
889 printf("got property notify\n");
891 if ((wwin
=wWindowFor(event
->xproperty
.window
))) {
892 if (!XGetGeometry(dpy
, wwin
->client_win
, &jr
, &ji
, &ji
,
893 &ju
, &ju
, &ju
, &ju
)) {
896 wClientCheckProperty(wwin
, &event
->xproperty
);
898 wapp
= wApplicationOf(event
->xproperty
.window
);
900 wClientCheckProperty(wapp
->main_window_desc
, &event
->xproperty
);
903 scr
= wScreenForWindow(event
->xproperty
.window
);
904 if (scr
&& scr
->root_win
== event
->xproperty
.window
) {
906 wKWMCheckRootHintChange(scr
, &event
->xproperty
);
913 handleClientMessage(XEvent
*event
)
916 WObjDescriptor
*desc
;
918 printf("got client message\n");
920 /* handle transition from Normal to Iconic state */
921 if (event
->xclient
.message_type
== _XA_WM_CHANGE_STATE
922 && event
->xclient
.format
== 32
923 && event
->xclient
.data
.l
[0] == IconicState
) {
925 wwin
= wWindowFor(event
->xclient
.window
);
927 if (!wwin
->flags
.miniaturized
)
928 wIconifyWindow(wwin
);
929 } else if (event
->xclient
.message_type
== _XA_WM_COLORMAP_NOTIFY
930 && event
->xclient
.format
== 32) {
931 WScreen
*scr
= wScreenSearchForRootWindow(event
->xclient
.window
);
936 if (event
->xclient
.data
.l
[1] == 1) { /* starting */
937 wColormapAllowClientInstallation(scr
, True
);
938 } else { /* stopping */
939 wColormapAllowClientInstallation(scr
, False
);
941 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_COMMAND
) {
943 wDefaultsCheckDomains("bla");
945 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_WM_FUNCTION
) {
948 wapp
= wApplicationOf(event
->xclient
.window
);
950 switch (event
->xclient
.data
.l
[0]) {
951 case WMFHideOtherApplications
:
952 wHideOtherApplications(wapp
->main_window_desc
);
956 case WMFHideApplication
:
957 wHideApplication(wapp
);
963 wwin
= wWindowFor(event
->xclient
.window
);
965 switch (event
->xclient
.data
.l
[0]) {
966 case WMFHideOtherApplications
:
967 wHideOtherApplications(wwin
);
970 case WMFHideApplication
:
971 wHideApplication(wApplicationOf(wwin
->main_window
));
976 } else if (event
->xclient
.message_type
== _XA_GNUSTEP_WM_ATTR
) {
977 wwin
= wWindowFor(event
->xclient
.window
);
979 switch (event
->xclient
.data
.l
[0]) {
980 case GSWindowLevelAttr
:
982 int level
= (int)event
->xclient
.data
.l
[1];
984 if (WINDOW_LEVEL(wwin
) != level
) {
985 ChangeStackingLevel(wwin
->frame
->core
, level
);
990 } else if (event
->xclient
.message_type
== _XA_GNUSTEP_TITLEBAR_STATE
) {
991 wwin
= wWindowFor(event
->xclient
.window
);
993 switch (event
->xclient
.data
.l
[0]) {
994 case WMTitleBarNormal
:
995 wFrameWindowChangeState(wwin
->frame
, WS_UNFOCUSED
);
998 wFrameWindowChangeState(wwin
->frame
, WS_PFOCUSED
);
1001 wFrameWindowChangeState(wwin
->frame
, WS_FOCUSED
);
1005 } else if (wNETWMProcessClientMessage(&event
->xclient
)) {
1009 } else if (wGNOMEProcessClientMessage(&event
->xclient
)) {
1011 #endif /* GNOME_STUFF */
1013 } else if (wKWMProcessClientMessage(&event
->xclient
)) {
1015 #endif /* KWM_HINTS */
1017 } else if (wXDNDProcessClientMessage(&event
->xclient
)) {
1021 } else if (event
->xclient
.message_type
==_XA_DND_PROTOCOL
) {
1022 WScreen
*scr
= wScreenForWindow(event
->xclient
.window
);
1023 if (scr
&& wDockReceiveDNDDrop(scr
,event
))
1024 goto redirect_message
;
1025 #endif /* OFFIX_DND */
1031 * Non-standard thing, but needed by OffiX DND.
1032 * For when the icon frame gets a ClientMessage
1033 * that should have gone to the icon_window.
1035 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
1036 (XPointer
*)&desc
)!=XCNOENT
) {
1037 struct WIcon
*icon
=NULL
;
1039 if (desc
->parent_type
== WCLASS_MINIWINDOW
) {
1040 icon
= (WIcon
*)desc
->parent
;
1041 } else if (desc
->parent_type
== WCLASS_DOCK_ICON
1042 || desc
->parent_type
== WCLASS_APPICON
) {
1043 icon
= ((WAppIcon
*)desc
->parent
)->icon
;
1045 if (icon
&& (wwin
=icon
->owner
)) {
1046 if (wwin
->client_win
!=event
->xclient
.window
) {
1047 event
->xclient
.window
= wwin
->client_win
;
1048 XSendEvent(dpy
, wwin
->client_win
, False
, NoEventMask
,
1058 raiseWindow(WScreen
*scr
)
1062 scr
->autoRaiseTimer
= NULL
;
1064 wwin
= wWindowFor(scr
->autoRaiseWindow
);
1068 if (!wwin
->flags
.destroyed
&& wwin
->flags
.focused
) {
1069 wRaiseFrame(wwin
->frame
->core
);
1070 /* this is needed or a race condition will occur */
1077 handleEnterNotify(XEvent
*event
)
1080 WObjDescriptor
*desc
= NULL
;
1081 #ifdef VIRTUAL_DESKTOP
1082 void (*vdHandler
)(XEvent
* event
);
1085 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1087 printf("got enter notify\n");
1090 #ifdef VIRTUAL_DESKTOP
1091 if (XFindContext(dpy
, event
->xcrossing
.window
, wVEdgeContext
,
1092 (XPointer
*)&vdHandler
)!=XCNOENT
) {
1093 (*vdHandler
)( event
);
1097 if (XCheckTypedWindowEvent(dpy
, event
->xcrossing
.window
, LeaveNotify
,
1099 /* already left the window... */
1101 if (ev
.xcrossing
.mode
==event
->xcrossing
.mode
1102 && ev
.xcrossing
.detail
==event
->xcrossing
.detail
) {
1107 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1108 (XPointer
*)&desc
)!=XCNOENT
) {
1109 if(desc
->handle_enternotify
)
1110 (*desc
->handle_enternotify
)(desc
, event
);
1113 /* enter to window */
1114 wwin
= wWindowFor(event
->xcrossing
.window
);
1116 if (wPreferences
.colormap_mode
==WCM_POINTER
) {
1117 wColormapInstallForWindow(scr
, NULL
);
1119 if (scr
->autoRaiseTimer
1120 && event
->xcrossing
.root
==event
->xcrossing
.window
) {
1121 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1122 scr
->autoRaiseTimer
= NULL
;
1125 /* set auto raise timer even if in focus-follows-mouse mode
1126 * and the event is for the frame window, even if the window
1127 * has focus already. useful if you move the pointer from a focused
1128 * window to the root window and back pretty fast
1130 * set focus if in focus-follows-mouse mode and the event
1131 * is for the frame window and window doesn't have focus yet */
1132 if (wPreferences
.focus_mode
==WKF_SLOPPY
1133 && wwin
->frame
->core
->window
==event
->xcrossing
.window
1134 && !scr
->flags
.doing_alt_tab
) {
1136 if (!wwin
->flags
.focused
&& !WFLAGP(wwin
, no_focusable
))
1137 wSetFocusTo(scr
, wwin
);
1139 if (scr
->autoRaiseTimer
)
1140 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1141 scr
->autoRaiseTimer
= NULL
;
1143 if (wPreferences
.raise_delay
&& !WFLAGP(wwin
, no_focusable
)) {
1144 scr
->autoRaiseWindow
= wwin
->frame
->core
->window
;
1146 = WMAddTimerHandler(wPreferences
.raise_delay
,
1147 (WMCallback
*)raiseWindow
, scr
);
1150 /* Install colormap for window, if the colormap installation mode
1151 * is colormap_follows_mouse */
1152 if (wPreferences
.colormap_mode
==WCM_POINTER
) {
1153 if (wwin
->client_win
==event
->xcrossing
.window
)
1154 wColormapInstallForWindow(scr
, wwin
);
1156 wColormapInstallForWindow(scr
, NULL
);
1160 /* a little kluge to hide the clip balloon */
1161 if (!wPreferences
.flags
.noclip
&& scr
->flags
.clip_balloon_mapped
) {
1163 XUnmapWindow(dpy
, scr
->clip_balloon
);
1164 scr
->flags
.clip_balloon_mapped
= 0;
1166 if (desc
->parent_type
!=WCLASS_DOCK_ICON
1167 || scr
->clip_icon
!= desc
->parent
) {
1168 XUnmapWindow(dpy
, scr
->clip_balloon
);
1169 scr
->flags
.clip_balloon_mapped
= 0;
1174 if (event
->xcrossing
.window
== event
->xcrossing
.root
1175 && event
->xcrossing
.detail
== NotifyNormal
1176 && event
->xcrossing
.detail
!= NotifyInferior
1177 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1179 wSetFocusTo(scr
, scr
->focused_window
);
1183 wBalloonEnteredObject(scr
, desc
);
1189 handleLeaveNotify(XEvent
*event
)
1191 WObjDescriptor
*desc
= NULL
;
1193 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1194 (XPointer
*)&desc
)!=XCNOENT
) {
1195 if(desc
->handle_leavenotify
)
1196 (*desc
->handle_leavenotify
)(desc
, event
);
1203 handleShapeNotify(XEvent
*event
)
1205 XShapeEvent
*shev
= (XShapeEvent
*)event
;
1209 printf("got shape notify\n");
1211 while (XCheckTypedWindowEvent(dpy
, shev
->window
, event
->type
, &ev
)) {
1212 XShapeEvent
*sev
= (XShapeEvent
*)&ev
;
1214 if (sev
->kind
== ShapeBounding
) {
1215 if (sev
->shaped
== shev
->shaped
) {
1218 XPutBackEvent(dpy
, &ev
);
1224 wwin
= wWindowFor(shev
->window
);
1225 if (!wwin
|| shev
->kind
!= ShapeBounding
)
1228 if (!shev
->shaped
&& wwin
->flags
.shaped
) {
1230 wwin
->flags
.shaped
= 0;
1231 wWindowClearShape(wwin
);
1233 } else if (shev
->shaped
) {
1235 wwin
->flags
.shaped
= 1;
1236 wWindowSetShape(wwin
);
1241 #ifdef KEEP_XKB_LOCK_STATUS
1242 /* please help ]d if you know what to do */
1243 handleXkbIndicatorStateNotify(XEvent
*event
)
1247 XkbStateRec staterec
;
1250 for (i
=0; i
<wScreenCount
; i
++) {
1251 scr
= wScreenWithNumber(i
);
1252 wwin
= scr
->focused_window
;
1253 if (wwin
&& wwin
->flags
.focused
) {
1254 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1255 if (wwin
->frame
->languagemode
!= staterec
.group
) {
1256 wwin
->frame
->last_languagemode
= wwin
->frame
->languagemode
;
1257 wwin
->frame
->languagemode
= staterec
.group
;
1259 #ifdef XKB_BUTTON_HINT
1260 if (wwin
->frame
->titlebar
) {
1261 wFrameWindowPaint(wwin
->frame
);
1267 #endif /*KEEP_XKB_LOCK_STATUS*/
1270 handleColormapNotify(XEvent
*event
)
1274 Bool reinstall
= False
;
1276 wwin
= wWindowFor(event
->xcolormap
.window
);
1280 scr
= wwin
->screen_ptr
;
1284 if (event
->xcolormap
.new) {
1285 XWindowAttributes attr
;
1287 XGetWindowAttributes(dpy
, wwin
->client_win
, &attr
);
1289 if (wwin
== scr
->cmap_window
&& wwin
->cmap_window_no
== 0)
1290 scr
->current_colormap
= attr
.colormap
;
1293 } else if (event
->xcolormap
.state
== ColormapUninstalled
&&
1294 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1296 /* some bastard app (like XV) removed our colormap */
1298 * can't enforce or things like xscreensaver wont work
1301 } else if (event
->xcolormap
.state
== ColormapInstalled
&&
1302 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1304 /* someone has put our colormap back */
1308 } while (XCheckTypedEvent(dpy
, ColormapNotify
, event
)
1309 && ((wwin
= wWindowFor(event
->xcolormap
.window
)) || 1));
1311 if (reinstall
&& scr
->current_colormap
!=None
) {
1312 if (!scr
->flags
.colormap_stuff_blocked
)
1313 XInstallColormap(dpy
, scr
->current_colormap
);
1320 handleFocusIn(XEvent
*event
)
1325 * For applications that like stealing the focus.
1327 while (XCheckTypedEvent(dpy
, FocusIn
, event
));
1328 saveTimestamp(event
);
1329 if (event
->xfocus
.mode
== NotifyUngrab
1330 || event
->xfocus
.mode
== NotifyGrab
1331 || event
->xfocus
.detail
> NotifyNonlinearVirtual
) {
1335 wwin
= wWindowFor(event
->xfocus
.window
);
1336 if (wwin
&& !wwin
->flags
.focused
) {
1337 if (wwin
->flags
.mapped
)
1338 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1340 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1342 WScreen
*scr
= wScreenForWindow(event
->xfocus
.window
);
1344 wSetFocusTo(scr
, NULL
);
1350 windowUnderPointer(WScreen
*scr
)
1356 if (XQueryPointer(dpy
, scr
->root_win
, &bar
, &win
, &foo
, &foo
, &foo
, &foo
,
1358 return wWindowFor(win
);
1366 handleKeyPress(XEvent
*event
)
1368 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1369 WWindow
*wwin
= scr
->focused_window
;
1372 int command
=-1, index
;
1373 #ifdef KEEP_XKB_LOCK_STATUS
1374 XkbStateRec staterec
;
1375 #endif /*KEEP_XKB_LOCK_STATUS*/
1377 /* ignore CapsLock */
1378 modifiers
= event
->xkey
.state
& ValidModMask
;
1380 for (i
=0; i
<WKBD_LAST
; i
++) {
1381 if (wKeyBindings
[i
].keycode
==0)
1384 if (wKeyBindings
[i
].keycode
==event
->xkey
.keycode
1385 && (/*wKeyBindings[i].modifier==0
1386 ||*/ wKeyBindings
[i
].modifier
==modifiers
)) {
1400 if (!wRootMenuPerformShortcut(event
)) {
1402 static int dontLoop
= 0;
1404 if (dontLoop
> 10) {
1405 wwarning("problem with key event processing code");
1409 /* if the focused window is an internal window, try redispatching
1410 * the event to the managed window, as it can be a WINGs window */
1411 if (wwin
&& wwin
->flags
.internal_window
1412 && wwin
->client_leader
!=None
) {
1413 /* client_leader contains the WINGs toplevel */
1414 event
->xany
.window
= wwin
->client_leader
;
1415 WMHandleEvent(event
);
1422 #define ISMAPPED(w) ((w) && !(w)->flags.miniaturized && ((w)->flags.mapped || (w)->flags.shaded))
1423 #define ISFOCUSED(w) ((w) && (w)->flags.focused)
1428 /*OpenRootMenu(scr, event->xkey.x_root, event->xkey.y_root, True);*/
1430 WMRect rect
= wGetRectForHead(scr
, wGetHeadForPointerLocation(scr
));
1431 OpenRootMenu(scr
, rect
.pos
.x
+ rect
.size
.width
/2, rect
.pos
.y
+ rect
.size
.height
/2, True
);
1434 case WKBD_WINDOWLIST
:
1436 WMRect rect
= wGetRectForHead(scr
, wGetHeadForPointerLocation(scr
));
1437 OpenSwitchMenu(scr
, rect
.pos
.x
+ rect
.size
.width
/2, rect
.pos
.y
+ rect
.size
.height
/2, True
);
1441 case WKBD_WINDOWMENU
:
1442 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
))
1443 OpenWindowMenu(wwin
, wwin
->frame_x
,
1444 wwin
->frame_y
+wwin
->frame
->top_width
, True
);
1446 case WKBD_MINIATURIZE
:
1447 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)
1448 && !WFLAGP(wwin
, no_miniaturizable
)) {
1449 CloseWindowMenu(scr
);
1451 if (wwin
->protocols
.MINIATURIZE_WINDOW
)
1452 wClientSendProtocol(wwin
, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
,
1453 event
->xbutton
.time
);
1455 wIconifyWindow(wwin
);
1460 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1461 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1462 CloseWindowMenu(scr
);
1464 if (wapp
&& !WFLAGP(wapp
->main_window_desc
, no_appicon
)) {
1465 wHideApplication(wapp
);
1469 case WKBD_HIDE_OTHERS
:
1470 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1471 CloseWindowMenu(scr
);
1473 wHideOtherApplications(wwin
);
1477 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && IS_RESIZABLE(wwin
)) {
1478 int newdir
= (MAX_VERTICAL
|MAX_HORIZONTAL
);
1480 CloseWindowMenu(scr
);
1482 if (wwin
->flags
.maximized
== newdir
) {
1483 wUnmaximizeWindow(wwin
);
1485 wMaximizeWindow(wwin
, newdir
|MAX_KEYBOARD
);
1489 case WKBD_VMAXIMIZE
:
1490 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && IS_RESIZABLE(wwin
)) {
1491 int newdir
= (MAX_VERTICAL
^ wwin
->flags
.maximized
);
1493 CloseWindowMenu(scr
);
1496 wMaximizeWindow(wwin
, newdir
|MAX_KEYBOARD
);
1498 wUnmaximizeWindow(wwin
);
1502 case WKBD_HMAXIMIZE
:
1503 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && IS_RESIZABLE(wwin
)) {
1504 int newdir
= (MAX_HORIZONTAL
^ wwin
->flags
.maximized
);
1506 CloseWindowMenu(scr
);
1509 wMaximizeWindow(wwin
, newdir
|MAX_KEYBOARD
);
1511 wUnmaximizeWindow(wwin
);
1516 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1517 CloseWindowMenu(scr
);
1519 wRaiseFrame(wwin
->frame
->core
);
1523 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1524 CloseWindowMenu(scr
);
1526 wLowerFrame(wwin
->frame
->core
);
1529 case WKBD_RAISELOWER
:
1530 /* raise or lower the window under the pointer, not the
1533 wwin
= windowUnderPointer(scr
);
1535 wRaiseLowerFrame(wwin
->frame
->core
);
1538 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_shadeable
)) {
1539 if (wwin
->flags
.shaded
)
1540 wUnshadeWindow(wwin
);
1545 case WKBD_MOVERESIZE
:
1546 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) &&
1547 (IS_RESIZABLE(wwin
) || IS_MOVABLE(wwin
))) {
1548 CloseWindowMenu(scr
);
1550 wKeyboardMoveResizeWindow(wwin
);
1554 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_closable
)) {
1555 CloseWindowMenu(scr
);
1556 if (wwin
->protocols
.DELETE_WINDOW
)
1557 wClientSendProtocol(wwin
, _XA_WM_DELETE_WINDOW
,
1562 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1563 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1566 case WKBD_FOCUSNEXT
:
1567 StartWindozeCycle(wwin
, event
, True
);
1570 case WKBD_FOCUSPREV
:
1571 StartWindozeCycle(wwin
, event
, False
);
1574 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
1575 #define GOTOWORKS(wk) case WKBD_WORKSPACE##wk:\
1576 i = (scr->current_workspace/10)*10 + wk - 1;\
1577 if (wPreferences.ws_advance || i<scr->workspace_count)\
1578 wWorkspaceChange(scr, i);\
1581 #define GOTOWORKS(wk) case WKBD_WORKSPACE/**/wk:\
1582 i = (scr->current_workspace/10)*10 + wk - 1;\
1583 if (wPreferences.ws_advance || i<scr->workspace_count)\
1584 wWorkspaceChange(scr, i);\
1598 case WKBD_NEXTWORKSPACE
:
1599 wWorkspaceRelativeChange(scr
, 1);
1601 case WKBD_PREVWORKSPACE
:
1602 wWorkspaceRelativeChange(scr
, -1);
1615 index
= command
-WKBD_WINDOW1
;
1617 if (scr
->shortcutWindows
[index
]) {
1618 WMArray
*list
= scr
->shortcutWindows
[index
];
1620 int count
= WMGetArrayItemCount(list
);
1622 WMArrayIterator iter
;
1625 wUnselectWindows(scr
);
1626 cw
= scr
->current_workspace
;
1628 WM_ETARETI_ARRAY(list
, wwin
, iter
) {
1630 wWindowChangeWorkspace(wwin
, cw
);
1632 wMakeWindowVisible(wwin
);
1635 wSelectWindow(wwin
, True
);
1638 /* rotate the order of windows, to create a cycling effect */
1639 twin
= WMGetFromArray(list
, 0);
1640 WMDeleteFromArray(list
, 0);
1641 WMAddToArray(list
, twin
);
1643 } else if (wwin
&& ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1644 if (scr
->shortcutWindows
[index
]) {
1645 WMFreeArray(scr
->shortcutWindows
[index
]);
1646 scr
->shortcutWindows
[index
] = NULL
;
1649 if (wwin
->flags
.selected
&& scr
->selected_windows
) {
1650 scr
->shortcutWindows
[index
] =
1651 WMDuplicateArray(scr
->selected_windows
);
1652 /*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
1653 WMInsertInArray(scr->shortcutWindows[index], 0, wwin);*/
1655 scr
->shortcutWindows
[index
] = WMCreateArray(4);
1656 WMAddToArray(scr
->shortcutWindows
[index
], wwin
);
1659 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1662 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1665 } else if (scr
->selected_windows
1666 && WMGetArrayItemCount(scr
->selected_windows
)) {
1668 if (wwin
->flags
.selected
&& scr
->selected_windows
) {
1669 if (scr
->shortcutWindows
[index
]) {
1670 WMFreeArray(scr
->shortcutWindows
[index
]);
1672 scr
->shortcutWindows
[index
] =
1673 WMDuplicateArray(scr
->selected_windows
);
1679 case WKBD_SWITCH_SCREEN
:
1680 if (wScreenCount
> 1) {
1684 /* find index of this screen */
1685 for (i
= 0; i
< wScreenCount
; i
++) {
1686 if (wScreenWithNumber(i
) == scr
)
1690 if (i
>= wScreenCount
) {
1693 scr2
= wScreenWithNumber(i
);
1696 XWarpPointer(dpy
, scr
->root_win
, scr2
->root_win
, 0, 0, 0, 0,
1697 scr2
->scr_width
/2, scr2
->scr_height
/2);
1702 case WKBD_NEXTWSLAYER
:
1703 case WKBD_PREVWSLAYER
:
1707 row
= scr
->current_workspace
/10;
1708 column
= scr
->current_workspace
%10;
1710 if (command
==WKBD_NEXTWSLAYER
) {
1711 if ((row
+1)*10 < scr
->workspace_count
)
1712 wWorkspaceChange(scr
, column
+(row
+1)*10);
1715 wWorkspaceChange(scr
, column
+(row
-1)*10);
1719 case WKBD_CLIPLOWER
:
1720 if (!wPreferences
.flags
.noclip
)
1721 wDockLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1723 case WKBD_CLIPRAISE
:
1724 if (!wPreferences
.flags
.noclip
)
1725 wDockRaise(scr
->workspaces
[scr
->current_workspace
]->clip
);
1727 case WKBD_CLIPRAISELOWER
:
1728 if (!wPreferences
.flags
.noclip
)
1729 wDockRaiseLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1731 #ifdef KEEP_XKB_LOCK_STATUS
1733 if(wPreferences
.modelock
) {
1735 wwin
= scr
->focused_window
;
1737 if (wwin
&& wwin
->flags
.mapped
1738 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
1739 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
) {
1740 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1742 wwin
->frame
->languagemode
= wwin
->frame
->last_languagemode
;
1743 wwin
->frame
->last_languagemode
= staterec
.group
;
1744 XkbLockGroup(dpy
,XkbUseCoreKbd
, wwin
->frame
->languagemode
);
1749 #endif /* KEEP_XKB_LOCK_STATUS */
1750 #ifdef VIRTUAL_DESKTOP
1751 case WKBD_VDESK_LEFT
:
1752 wWorkspaceKeyboardMoveDesktop(scr
, VEC_LEFT
);
1755 case WKBD_VDESK_RIGHT
:
1756 wWorkspaceKeyboardMoveDesktop(scr
, VEC_RIGHT
);
1760 wWorkspaceKeyboardMoveDesktop(scr
, VEC_UP
);
1763 case WKBD_VDESK_DOWN
:
1764 wWorkspaceKeyboardMoveDesktop(scr
, VEC_DOWN
);
1773 handleMotionNotify(XEvent
*event
)
1775 WScreen
*scr
= wScreenForRootWindow(event
->xmotion
.root
);
1777 if (wPreferences
.scrollable_menus
) {
1778 WMPoint p
= wmkpoint(event
->xmotion
.x_root
, event
->xmotion
.y_root
);
1779 WMRect rect
= wGetRectForHead(scr
, wGetHeadForPoint(scr
, p
));
1781 if (scr
->flags
.jump_back_pending
||
1782 p
.x
<= (rect
.pos
.x
+ 1) ||
1783 p
.x
>= (rect
.pos
.x
+ rect
.size
.width
- 2) ||
1784 p
.y
<= (rect
.pos
.y
+ 1) ||
1785 p
.y
>= (rect
.pos
.y
+ rect
.size
.height
- 2)) {
1788 printf("pointer at screen edge\n");
1790 menu
= wMenuUnderPointer(scr
);
1792 wMenuScroll(menu
, event
);
1796 #if 0 // what is with this? -Dan
1797 if (event
->xmotion
.subwindow
== None
)
1800 if (scr
->scrolledFMaximize
!= None
) {
1803 twin
= wWindowFor(scr
->scrolledFMaximize
);
1804 if (twin
&& twin
->frame_y
==) {
1808 scr
->scrolledFMaximize
= NULL
;
1812 /* scroll full maximized window */
1813 if (event
->xmotion
.y_root
< 1
1814 || event
->xmotion
.y_root
> scr
->scr_height
- 1) {
1816 wwin
= wWindowFor(event
->xmotion
.subwindow
);
1818 if (wwin
&& (wwin
->flags
.maximized
& MAX_VERTICAL
)
1819 && WFLAGP(wwin
, full_maximize
)
1820 && event
->xmotion
.x_root
>= wwin
->frame_x
1821 && event
->xmotion
.x_root
<= wwin
->frame_x
+ wwin
->frame
->core
->width
) {
1823 if (HAS_BORDER(wwin
)
1824 && wwin
->frame_y
<= - wwin
->frame
->top_width
) {
1826 wWindowMove(wwin
, wwin
->frame_x
, 0);
1827 wwin
->flags
.dragged_while_fmaximized
= 0;
1829 } else if (HAS_RESIZEBAR(wwin
)
1830 && wwin
->frame_y
+ wwin
->frame
->core
->height
>=
1831 scr
->scr_height
+ wwin
->frame
->bottom_width
) {
1833 int y
= scr
->scr_height
+ wwin
->frame
->bottom_width
;
1835 y
= scr
->scr_height
- wwin
->frame_y
- wwin
->frame
->core
->height
;
1837 wWindowMove(wwin
, wwin
->frame_x
, y
);
1838 wwin
->flags
.dragged_while_fmaximized
= 0;
1847 handleVisibilityNotify(XEvent
*event
)
1851 wwin
= wWindowFor(event
->xvisibility
.window
);
1854 wwin
->flags
.obscured
=
1855 (event
->xvisibility
.state
== VisibilityFullyObscured
);