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,
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"
69 /******** Global Variables **********/
70 extern XContext wWinContext
;
72 extern Cursor wCursor
[WCUR_LAST
];
74 extern WShortKey wKeyBindings
[WKBD_LAST
];
75 extern int wScreenCount
;
76 extern Time LastTimestamp
;
77 extern Time LastFocusChange
;
79 extern WPreferences wPreferences
;
81 #define MOD_MASK wPreferences.modifier_mask
83 extern Atom _XA_WM_COLORMAP_NOTIFY
;
85 extern Atom _XA_WM_CHANGE_STATE
;
86 extern Atom _XA_WM_DELETE_WINDOW
;
87 extern Atom _XA_GNUSTEP_WM_ATTR
;
88 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
;
89 extern Atom _XA_GNUSTEP_TITLEBAR_STATE
;
90 extern Atom _XA_WINDOWMAKER_WM_FUNCTION
;
91 extern Atom _XA_WINDOWMAKER_COMMAND
;
94 extern Atom _XA_DND_PROTOCOL
;
99 extern Bool wShapeSupported
;
100 extern int wShapeEventBase
;
103 #ifdef KEEP_XKB_LOCK_STATUS
104 extern int wXkbEventBase
;
108 extern char WDelayedActionSet
;
111 /************ Local stuff ***********/
114 static void saveTimestamp(XEvent
*event
);
115 static void handleColormapNotify();
116 static void handleMapNotify(), handleUnmapNotify();
117 static void handleButtonPress(), handleExpose();
118 static void handleDestroyNotify();
119 static void handleConfigureRequest();
120 static void handleMapRequest();
121 static void handlePropertyNotify();
122 static void handleEnterNotify();
123 static void handleLeaveNotify();
124 static void handleExtensions();
125 static void handleClientMessage();
126 static void handleKeyPress();
127 static void handleFocusIn();
128 static void handleMotionNotify();
129 static void handleVisibilityNotify();
133 static void handleShapeNotify();
136 /* called from the signal handler */
137 void NotifyDeadProcess(pid_t pid
, unsigned char status
);
139 /* real dead process handler */
140 static void handleDeadProcess(void *foo
);
143 typedef struct DeadProcesses
{
145 unsigned char exit_status
;
148 /* stack of dead processes */
149 static DeadProcesses deadProcesses
[MAX_DEAD_PROCESSES
];
150 static int deadProcessPtr
=0;
153 typedef struct DeathHandler
{
154 WDeathHandler
*callback
;
159 static WMArray
*deathHandlers
=NULL
;
164 wAddDeathHandler(pid_t pid
, WDeathHandler
*callback
, void *cdata
)
166 DeathHandler
*handler
;
168 handler
= malloc(sizeof(DeathHandler
));
173 handler
->callback
= callback
;
174 handler
->client_data
= cdata
;
177 deathHandlers
= WMCreateArrayWithDestructor(8, wfree
);
179 WMAddToArray(deathHandlers
, handler
);
187 wDeleteDeathHandler(WMagicNumber id
)
189 DeathHandler
*handler
=(DeathHandler
*)id
;
191 if (!handler
|| !deathHandlers
)
194 /* array destructor will call wfree(handler) */
195 WMRemoveFromArray(deathHandlers
, handler
);
200 DispatchEvent(XEvent
*event
)
203 handleDeadProcess(NULL
);
205 if (WCHECK_STATE(WSTATE_NEED_EXIT
)) {
206 WCHANGE_STATE(WSTATE_EXITING
);
207 /* received SIGTERM */
209 * WMHandleEvent() can't be called from anything
210 * executed inside here, or we can get in a infinite
213 Shutdown(WSExitMode
);
215 } else if (WCHECK_STATE(WSTATE_NEED_RESTART
)) {
216 WCHANGE_STATE(WSTATE_RESTARTING
);
218 Shutdown(WSRestartPreparationMode
);
219 /* received SIGHUP */
221 } else if (WCHECK_STATE(WSTATE_NEED_REREAD
)) {
222 WCHANGE_STATE(WSTATE_NORMAL
);
223 wDefaultsCheckDomains("bla");
226 /* for the case that all that is wanted to be dispatched is
231 saveTimestamp(event
);
232 switch (event
->type
) {
234 handleMapRequest(event
);
238 handleKeyPress(event
);
242 handleMotionNotify(event
);
245 case ConfigureRequest
:
246 handleConfigureRequest(event
);
250 handleDestroyNotify(event
);
254 handleMapNotify(event
);
258 handleUnmapNotify(event
);
262 handleButtonPress(event
);
270 handlePropertyNotify(event
);
274 handleEnterNotify(event
);
278 handleLeaveNotify(event
);
282 handleClientMessage(event
);
286 handleColormapNotify(event
);
290 if (event
->xmapping
.request
== MappingKeyboard
291 || event
->xmapping
.request
== MappingModifier
)
292 XRefreshKeyboardMapping(&event
->xmapping
);
296 handleFocusIn(event
);
299 case VisibilityNotify
:
300 handleVisibilityNotify(event
);
303 handleExtensions(event
);
310 *----------------------------------------------------------------------
312 * Processes X and internal events indefinitely.
318 * The LastTimestamp global variable is updated.
319 *----------------------------------------------------------------------
327 WMNextEvent(dpy
, &event
);
328 WMHandleEvent(&event
);
335 IsDoubleClick(WScreen
*scr
, XEvent
*event
)
337 if ((scr
->last_click_time
>0) &&
338 (event
->xbutton
.time
-scr
->last_click_time
<=wPreferences
.dblclick_time
)
339 && (event
->xbutton
.button
== scr
->last_click_button
)
340 && (event
->xbutton
.window
== scr
->last_click_window
)) {
342 scr
->flags
.next_click_is_not_double
= 1;
343 scr
->last_click_time
= 0;
344 scr
->last_click_window
= event
->xbutton
.window
;
353 NotifyDeadProcess(pid_t pid
, unsigned char status
)
355 if (deadProcessPtr
>=MAX_DEAD_PROCESSES
-1) {
356 wwarning("stack overflow: too many dead processes");
359 /* stack the process to be handled later,
360 * as this is called from the signal handler */
361 deadProcesses
[deadProcessPtr
].pid
= pid
;
362 deadProcesses
[deadProcessPtr
].exit_status
= status
;
368 handleDeadProcess(void *foo
)
373 for (i
=0; i
<deadProcessPtr
; i
++) {
374 wWindowDeleteSavedStatesForPID(deadProcesses
[i
].pid
);
377 if (!deathHandlers
) {
382 /* get the pids on the queue and call handlers */
383 while (deadProcessPtr
>0) {
386 for (i
= WMGetArrayItemCount(deathHandlers
)-1; i
>= 0; i
--) {
387 tmp
= WMGetFromArray(deathHandlers
, i
);
391 if (tmp
->pid
== deadProcesses
[deadProcessPtr
].pid
) {
392 (*tmp
->callback
)(tmp
->pid
,
393 deadProcesses
[deadProcessPtr
].exit_status
,
395 wDeleteDeathHandler(tmp
);
403 saveTimestamp(XEvent
*event
)
405 LastTimestamp
= CurrentTime
;
407 switch (event
->type
) {
410 LastTimestamp
= event
->xbutton
.time
;
414 LastTimestamp
= event
->xkey
.time
;
417 LastTimestamp
= event
->xmotion
.time
;
420 LastTimestamp
= event
->xproperty
.time
;
424 LastTimestamp
= event
->xcrossing
.time
;
427 LastTimestamp
= event
->xselectionclear
.time
;
429 case SelectionRequest
:
430 LastTimestamp
= event
->xselectionrequest
.time
;
432 case SelectionNotify
:
433 LastTimestamp
= event
->xselection
.time
;
435 wXDNDProcessSelection(event
);
443 handleExtensions(XEvent
*event
)
445 #ifdef KEEP_XKB_LOCK_STATUS
447 xkbevent
= (XkbEvent
*)event
;
448 #endif /*KEEP_XKB_LOCK_STATUS*/
450 if (wShapeSupported
&& event
->type
== (wShapeEventBase
+ShapeNotify
)) {
451 handleShapeNotify(event
);
454 #ifdef KEEP_XKB_LOCK_STATUS
455 if (wPreferences
.modelock
&& (xkbevent
->type
== wXkbEventBase
)){
456 handleXkbIndicatorStateNotify(event
);
458 #endif /*KEEP_XKB_LOCK_STATUS*/
463 handleMapRequest(XEvent
*ev
)
467 Window window
= ev
->xmaprequest
.window
;
470 L("got map request for %x\n", (unsigned)window
);
472 if ((wwin
= wWindowFor(window
))) {
473 if (wwin
->flags
.shaded
) {
474 wUnshadeWindow(wwin
);
476 /* deiconify window */
477 if (wwin
->flags
.miniaturized
) {
478 wDeiconifyWindow(wwin
);
479 } else if (wwin
->flags
.hidden
) {
480 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
481 /* go to the last workspace that the user worked on the app */
483 wWorkspaceChange(wwin
->screen_ptr
, wapp
->last_workspace
);
485 wUnhideApplication(wapp
, False
, False
);
490 scr
= wScreenForRootWindow(ev
->xmaprequest
.parent
);
492 wwin
= wManageWindow(scr
, window
);
495 * This is to let the Dock know that the application it launched
496 * has already been mapped (eg: it has finished launching).
497 * It is not necessary for normally docked apps, but is needed for
498 * apps that were forcedly docked (like with dockit).
500 if (scr
->last_dock
) {
501 if (wwin
&& wwin
->main_window
!=None
&& wwin
->main_window
!=window
)
502 wDockTrackWindowLaunch(scr
->last_dock
, wwin
->main_window
);
504 wDockTrackWindowLaunch(scr
->last_dock
, window
);
508 wClientSetState(wwin
, NormalState
, None
);
509 if (wwin
->flags
.maximized
) {
510 wMaximizeWindow(wwin
, wwin
->flags
.maximized
);
512 if (wwin
->flags
.shaded
) {
513 wwin
->flags
.shaded
= 0;
514 wwin
->flags
.skip_next_animation
= 1;
517 if (wwin
->flags
.miniaturized
) {
518 wwin
->flags
.miniaturized
= 0;
519 wwin
->flags
.skip_next_animation
= 1;
520 wIconifyWindow(wwin
);
522 if (wwin
->flags
.hidden
) {
523 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
525 wwin
->flags
.hidden
= 0;
526 wwin
->flags
.skip_next_animation
= 1;
528 wHideApplication(wapp
);
536 handleDestroyNotify(XEvent
*event
)
540 Window window
= event
->xdestroywindow
.window
;
543 L("got destroy notify");
545 wwin
= wWindowFor(window
);
547 wUnmanageWindow(wwin
, False
, True
);
550 app
= wApplicationOf(window
);
552 if (window
== app
->main_window
) {
554 wwin
= app
->main_window_desc
->screen_ptr
->focused_window
;
556 if (wwin
->main_window
== window
) {
557 wwin
->main_window
= None
;
562 wApplicationDestroy(app
);
566 wKWMCheckDestroy(&event
->xdestroywindow
);
573 handleExpose(XEvent
*event
)
575 WObjDescriptor
*desc
;
581 while (XCheckTypedWindowEvent(dpy
, event
->xexpose
.window
, Expose
, &ev
));
583 if (XFindContext(dpy
, event
->xexpose
.window
, wWinContext
,
584 (XPointer
*)&desc
)==XCNOENT
) {
588 if (desc
->handle_expose
) {
589 (*desc
->handle_expose
)(desc
, event
);
594 executeButtonAction(WScreen
*scr
, XEvent
*event
, int action
)
597 case WA_SELECT_WINDOWS
:
598 wUnselectWindows(scr
);
599 wSelectWindows(scr
, event
);
601 case WA_OPEN_APPMENU
:
602 OpenRootMenu(scr
, event
->xbutton
.x_root
, event
->xbutton
.y_root
, False
);
604 if (scr
->root_menu
) {
605 if (scr
->root_menu
->brother
->flags
.mapped
)
606 event
->xbutton
.window
= scr
->root_menu
->brother
->frame
->core
->window
;
608 event
->xbutton
.window
= scr
->root_menu
->frame
->core
->window
;
611 case WA_OPEN_WINLISTMENU
:
612 OpenSwitchMenu(scr
, event
->xbutton
.x_root
, event
->xbutton
.y_root
, False
);
613 if (scr
->switch_menu
) {
614 if (scr
->switch_menu
->brother
->flags
.mapped
)
615 event
->xbutton
.window
= scr
->switch_menu
->brother
->frame
->core
->window
;
617 event
->xbutton
.window
= scr
->switch_menu
->frame
->core
->window
;
628 handleButtonPress(XEvent
*event
)
630 WObjDescriptor
*desc
;
634 L("got button press");
636 scr
= wScreenForRootWindow(event
->xbutton
.root
);
644 if (event
->xbutton
.window
==scr
->root_win
) {
645 if (event
->xbutton
.button
==Button1
&&
646 wPreferences
.mouse_button1
!=WA_NONE
) {
647 executeButtonAction(scr
, event
, wPreferences
.mouse_button1
);
648 } else if (event
->xbutton
.button
==Button2
&&
649 wPreferences
.mouse_button2
!=WA_NONE
) {
650 executeButtonAction(scr
, event
, wPreferences
.mouse_button2
);
651 } else if (event
->xbutton
.button
==Button3
&&
652 wPreferences
.mouse_button3
!=WA_NONE
) {
653 executeButtonAction(scr
, event
, wPreferences
.mouse_button3
);
654 } else if (event
->xbutton
.button
==Button4
&&
655 wPreferences
.mouse_wheel
!=WA_NONE
) {
656 wWorkspaceRelativeChange(scr
, 1);
657 } else if (event
->xbutton
.button
==Button5
&&
658 wPreferences
.mouse_wheel
!=WA_NONE
) {
659 wWorkspaceRelativeChange(scr
, -1);
662 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
->parent_type
== WCLASS_WINDOW
) {
680 if (event
->xbutton
.state
& MOD_MASK
) {
681 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
684 /* if (wPreferences.focus_mode == WKF_CLICK) {*/
685 if (wPreferences
.ignore_focus_click
) {
686 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
688 XAllowEvents(dpy
, ReplayPointer
, CurrentTime
);
691 } else if (desc
->parent_type
== WCLASS_APPICON
692 || desc
->parent_type
== WCLASS_MINIWINDOW
693 || desc
->parent_type
== WCLASS_DOCK_ICON
) {
694 if (event
->xbutton
.state
& MOD_MASK
) {
696 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
701 if (desc
->handle_mousedown
!=NULL
) {
702 (*desc
->handle_mousedown
)(desc
, event
);
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
)
723 wwin
= wWindowFor(event
->xmap
.event
);
724 if (wwin
&& wwin
->client_win
== event
->xmap
.event
) {
725 if (wwin
->flags
.miniaturized
) {
726 wDeiconifyWindow(wwin
);
730 wClientSetState(wwin
, NormalState
, None
);
738 handleUnmapNotify(XEvent
*event
)
742 Bool withdraw
= False
;
746 /* only process windows with StructureNotify selected
747 * (ignore SubstructureNotify) */
748 wwin
= wWindowFor(event
->xunmap
.window
);
752 /* whether the event is a Withdrawal request */
753 if (event
->xunmap
.event
== wwin
->screen_ptr
->root_win
754 && event
->xunmap
.send_event
)
757 if (wwin
->client_win
!= event
->xunmap
.event
&& !withdraw
)
760 if (!wwin
->flags
.mapped
&& !withdraw
761 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
762 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
)
766 XUnmapWindow(dpy
, wwin
->frame
->core
->window
);
767 wwin
->flags
.mapped
= 0;
769 /* check if the window was destroyed */
770 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, DestroyNotify
,&ev
)) {
773 Bool reparented
= False
;
775 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, ReparentNotify
, &ev
))
778 /* withdraw window */
779 wwin
->flags
.mapped
= 0;
781 wClientSetState(wwin
, WithdrawnState
, None
);
783 /* if the window was reparented, do not reparent it back to the
785 wUnmanageWindow(wwin
, !reparented
, False
);
792 handleConfigureRequest(XEvent
*event
)
796 L("got configure request");
798 if (!(wwin
=wWindowFor(event
->xconfigurerequest
.window
))) {
800 * Configure request for unmapped window
802 wClientConfigure(NULL
, &(event
->xconfigurerequest
));
804 wClientConfigure(wwin
, &(event
->xconfigurerequest
));
810 handlePropertyNotify(XEvent
*event
)
819 L("got property notify");
821 if ((wwin
=wWindowFor(event
->xproperty
.window
))) {
822 if (!XGetGeometry(dpy
, wwin
->client_win
, &jr
, &ji
, &ji
,
823 &ju
, &ju
, &ju
, &ju
)) {
826 wClientCheckProperty(wwin
, &event
->xproperty
);
828 wapp
= wApplicationOf(event
->xproperty
.window
);
830 wClientCheckProperty(wapp
->main_window_desc
, &event
->xproperty
);
833 scr
= wScreenForWindow(event
->xproperty
.window
);
834 if (scr
&& scr
->root_win
== event
->xproperty
.window
) {
836 wKWMCheckRootHintChange(scr
, &event
->xproperty
);
843 handleClientMessage(XEvent
*event
)
846 WObjDescriptor
*desc
;
848 L("got client message");
850 /* handle transition from Normal to Iconic state */
851 if (event
->xclient
.message_type
== _XA_WM_CHANGE_STATE
852 && event
->xclient
.format
== 32
853 && event
->xclient
.data
.l
[0] == IconicState
) {
855 wwin
= wWindowFor(event
->xclient
.window
);
857 if (!wwin
->flags
.miniaturized
)
858 wIconifyWindow(wwin
);
859 } else if (event
->xclient
.message_type
== _XA_WM_COLORMAP_NOTIFY
860 && event
->xclient
.format
== 32) {
861 WScreen
*scr
= wScreenSearchForRootWindow(event
->xclient
.window
);
866 if (event
->xclient
.data
.l
[1] == 1) { /* starting */
867 wColormapAllowClientInstallation(scr
, True
);
868 } else { /* stopping */
869 wColormapAllowClientInstallation(scr
, False
);
871 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_COMMAND
) {
873 wDefaultsCheckDomains("bla");
875 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_WM_FUNCTION
) {
878 wapp
= wApplicationOf(event
->xclient
.window
);
880 switch (event
->xclient
.data
.l
[0]) {
881 case WMFHideOtherApplications
:
882 wHideOtherApplications(wapp
->main_window_desc
);
886 case WMFHideApplication
:
887 wHideApplication(wapp
);
893 wwin
= wWindowFor(event
->xclient
.window
);
895 switch (event
->xclient
.data
.l
[0]) {
896 case WMFHideOtherApplications
:
897 wHideOtherApplications(wwin
);
900 case WMFHideApplication
:
901 wHideApplication(wApplicationOf(wwin
->main_window
));
906 } else if (event
->xclient
.message_type
== _XA_GNUSTEP_WM_ATTR
) {
907 wwin
= wWindowFor(event
->xclient
.window
);
909 switch (event
->xclient
.data
.l
[0]) {
910 case GSWindowLevelAttr
:
912 int level
= (int)event
->xclient
.data
.l
[1];
914 if (WINDOW_LEVEL(wwin
) != level
) {
915 ChangeStackingLevel(wwin
->frame
->core
, level
);
920 } else if (event
->xclient
.message_type
== _XA_GNUSTEP_TITLEBAR_STATE
) {
921 wwin
= wWindowFor(event
->xclient
.window
);
923 switch (event
->xclient
.data
.l
[0]) {
924 case WMTitleBarNormal
:
925 wFrameWindowChangeState(wwin
->frame
, WS_UNFOCUSED
);
928 wFrameWindowChangeState(wwin
->frame
, WS_PFOCUSED
);
931 wFrameWindowChangeState(wwin
->frame
, WS_FOCUSED
);
935 } else if (wGNOMEProcessClientMessage(&event
->xclient
)) {
937 #endif /* GNOME_STUFF */
939 } else if (wKWMProcessClientMessage(&event
->xclient
)) {
941 #endif /* KWM_HINTS */
943 } else if (wXDNDProcessClientMessage(&event
->xclient
)) {
947 } else if (event
->xclient
.message_type
==_XA_DND_PROTOCOL
) {
948 WScreen
*scr
= wScreenForWindow(event
->xclient
.window
);
949 if (scr
&& wDockReceiveDNDDrop(scr
,event
))
950 goto redirect_message
;
951 #endif /* OFFIX_DND */
957 * Non-standard thing, but needed by OffiX DND.
958 * For when the icon frame gets a ClientMessage
959 * that should have gone to the icon_window.
961 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
962 (XPointer
*)&desc
)!=XCNOENT
) {
963 struct WIcon
*icon
=NULL
;
965 if (desc
->parent_type
== WCLASS_MINIWINDOW
) {
966 icon
= (WIcon
*)desc
->parent
;
967 } else if (desc
->parent_type
== WCLASS_DOCK_ICON
968 || desc
->parent_type
== WCLASS_APPICON
) {
969 icon
= ((WAppIcon
*)desc
->parent
)->icon
;
971 if (icon
&& (wwin
=icon
->owner
)) {
972 if (wwin
->client_win
!=event
->xclient
.window
) {
973 event
->xclient
.window
= wwin
->client_win
;
974 XSendEvent(dpy
, wwin
->client_win
, False
, NoEventMask
,
984 raiseWindow(WScreen
*scr
)
988 scr
->autoRaiseTimer
= NULL
;
990 wwin
= wWindowFor(scr
->autoRaiseWindow
);
994 if (!wwin
->flags
.destroyed
&& wwin
->flags
.focused
) {
995 wRaiseFrame(wwin
->frame
->core
);
996 /* this is needed or a race condition will occur */
1003 handleEnterNotify(XEvent
*event
)
1006 WObjDescriptor
*desc
= NULL
;
1008 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1010 L("got enter notify");
1013 #ifdef VIRTUAL_DESKTOP
1014 /* TODO: acceleration code */
1015 if (wPreferences
.vedge_thickness
) {
1017 if (event
->xcrossing
.window
== scr
->virtual_edge_r
) {
1018 XWarpPointer(dpy
, None
, scr
->root_win
, 0,0,0,0, scr
->scr_width
- wPreferences
.vedge_thickness
- 1, event
->xcrossing
.y_root
);
1019 wWorkspaceGetViewPosition(scr
, scr
->current_workspace
, &x
, &y
);
1020 wWorkspaceSetViewPort(scr
, scr
->current_workspace
, x
+ VIRTUALEDGE_SCROLL_HSTEP
, y
);
1021 } else if (event
->xcrossing
.window
== scr
->virtual_edge_l
) {
1022 XWarpPointer(dpy
, None
, scr
->root_win
, 0,0,0,0, wPreferences
.vedge_thickness
+ 1, event
->xcrossing
.y_root
);
1023 wWorkspaceGetViewPosition(scr
, scr
->current_workspace
, &x
, &y
);
1024 wWorkspaceSetViewPort(scr
, scr
->current_workspace
, x
- VIRTUALEDGE_SCROLL_HSTEP
, y
);
1025 } else if (event
->xcrossing
.window
== scr
->virtual_edge_u
) {
1026 XWarpPointer(dpy
, None
, scr
->root_win
, 0,0,0,0, event
->xcrossing
.x_root
, wPreferences
.vedge_thickness
+ 1);
1027 wWorkspaceGetViewPosition(scr
, scr
->current_workspace
, &x
, &y
);
1028 wWorkspaceSetViewPort(scr
, scr
->current_workspace
, x
, y
- VIRTUALEDGE_SCROLL_VSTEP
);
1029 } else if (event
->xcrossing
.window
== scr
->virtual_edge_d
) {
1030 printf("enter bottom\n");
1031 XWarpPointer(dpy
, None
, scr
->root_win
, 0,0,0,0, event
->xcrossing
.x_root
, scr
->scr_height
- wPreferences
.vedge_thickness
- 1);
1032 wWorkspaceGetViewPosition(scr
, scr
->current_workspace
, &x
, &y
);
1033 wWorkspaceSetViewPort(scr
, scr
->current_workspace
, x
, y
+ VIRTUALEDGE_SCROLL_VSTEP
);
1038 if (XCheckTypedWindowEvent(dpy
, event
->xcrossing
.window
, LeaveNotify
,
1040 /* already left the window... */
1042 if (ev
.xcrossing
.mode
==event
->xcrossing
.mode
1043 && ev
.xcrossing
.detail
==event
->xcrossing
.detail
) {
1048 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1049 (XPointer
*)&desc
)!=XCNOENT
) {
1050 if(desc
->handle_enternotify
)
1051 (*desc
->handle_enternotify
)(desc
, event
);
1054 /* enter to window */
1055 wwin
= wWindowFor(event
->xcrossing
.window
);
1057 if (wPreferences
.colormap_mode
==WCM_POINTER
) {
1058 wColormapInstallForWindow(scr
, NULL
);
1060 if (scr
->autoRaiseTimer
1061 && event
->xcrossing
.root
==event
->xcrossing
.window
) {
1062 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1063 scr
->autoRaiseTimer
= NULL
;
1066 /* set auto raise timer even if in focus-follows-mouse mode
1067 * and the event is for the frame window, even if the window
1068 * has focus already. useful if you move the pointer from a focused
1069 * window to the root window and back pretty fast
1071 * set focus if in focus-follows-mouse mode and the event
1072 * is for the frame window and window doesn't have focus yet */
1073 if (wPreferences
.focus_mode
==WKF_SLOPPY
1074 && wwin
->frame
->core
->window
==event
->xcrossing
.window
1075 && !scr
->flags
.doing_alt_tab
) {
1077 if (!wwin
->flags
.focused
&& !WFLAGP(wwin
, no_focusable
))
1078 wSetFocusTo(scr
, wwin
);
1080 if (scr
->autoRaiseTimer
)
1081 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1082 scr
->autoRaiseTimer
= NULL
;
1084 if (wPreferences
.raise_delay
&& !WFLAGP(wwin
, no_focusable
)) {
1085 scr
->autoRaiseWindow
= wwin
->frame
->core
->window
;
1087 = WMAddTimerHandler(wPreferences
.raise_delay
,
1088 (WMCallback
*)raiseWindow
, scr
);
1091 /* Install colormap for window, if the colormap installation mode
1092 * is colormap_follows_mouse */
1093 if (wPreferences
.colormap_mode
==WCM_POINTER
) {
1094 if (wwin
->client_win
==event
->xcrossing
.window
)
1095 wColormapInstallForWindow(scr
, wwin
);
1097 wColormapInstallForWindow(scr
, NULL
);
1101 /* a little kluge to hide the clip balloon */
1102 if (!wPreferences
.flags
.noclip
&& scr
->flags
.clip_balloon_mapped
) {
1104 XUnmapWindow(dpy
, scr
->clip_balloon
);
1105 scr
->flags
.clip_balloon_mapped
= 0;
1107 if (desc
->parent_type
!=WCLASS_DOCK_ICON
1108 || scr
->clip_icon
!= desc
->parent
) {
1109 XUnmapWindow(dpy
, scr
->clip_balloon
);
1110 scr
->flags
.clip_balloon_mapped
= 0;
1115 if (event
->xcrossing
.window
== event
->xcrossing
.root
1116 && event
->xcrossing
.detail
== NotifyNormal
1117 && event
->xcrossing
.detail
!= NotifyInferior
1118 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1120 wSetFocusTo(scr
, scr
->focused_window
);
1124 wBalloonEnteredObject(scr
, desc
);
1130 handleLeaveNotify(XEvent
*event
)
1132 WObjDescriptor
*desc
= NULL
;
1134 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1135 (XPointer
*)&desc
)!=XCNOENT
) {
1136 if(desc
->handle_leavenotify
)
1137 (*desc
->handle_leavenotify
)(desc
, event
);
1139 if (event
->xcrossing
.window
== event
->xcrossing
.root
1140 && event
->xcrossing
.mode
== NotifyNormal
1141 && event
->xcrossing
.detail
!= NotifyInferior
1142 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1144 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1146 wSetFocusTo(scr
, NULL
);
1153 handleShapeNotify(XEvent
*event
)
1155 XShapeEvent
*shev
= (XShapeEvent
*)event
;
1159 L("got shape notify");
1161 while (XCheckTypedWindowEvent(dpy
, shev
->window
, event
->type
, &ev
)) {
1162 XShapeEvent
*sev
= (XShapeEvent
*)&ev
;
1164 if (sev
->kind
== ShapeBounding
) {
1165 if (sev
->shaped
== shev
->shaped
) {
1168 XPutBackEvent(dpy
, &ev
);
1174 wwin
= wWindowFor(shev
->window
);
1175 if (!wwin
|| shev
->kind
!= ShapeBounding
)
1178 if (!shev
->shaped
&& wwin
->flags
.shaped
) {
1180 wwin
->flags
.shaped
= 0;
1181 wWindowClearShape(wwin
);
1183 } else if (shev
->shaped
) {
1185 wwin
->flags
.shaped
= 1;
1186 wWindowSetShape(wwin
);
1191 #ifdef KEEP_XKB_LOCK_STATUS
1192 /* please help ]d if you know what to do */
1193 handleXkbIndicatorStateNotify(XEvent
*event
)
1197 XkbStateRec staterec
;
1200 for (i
=0; i
<wScreenCount
; i
++) {
1201 scr
= wScreenWithNumber(i
);
1202 wwin
= scr
->focused_window
;
1203 if (wwin
&& wwin
->flags
.focused
) {
1204 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1205 if (wwin
->frame
->languagemode
!= staterec
.group
) {
1206 wwin
->frame
->last_languagemode
= wwin
->frame
->languagemode
;
1207 wwin
->frame
->languagemode
= staterec
.group
;
1209 #ifdef XKB_BUTTON_HINT
1210 if (wwin
->frame
->titlebar
) {
1211 wFrameWindowPaint(wwin
->frame
);
1217 #endif /*KEEP_XKB_LOCK_STATUS*/
1220 handleColormapNotify(XEvent
*event
)
1224 Bool reinstall
= False
;
1226 wwin
= wWindowFor(event
->xcolormap
.window
);
1230 scr
= wwin
->screen_ptr
;
1234 if (event
->xcolormap
.new) {
1235 XWindowAttributes attr
;
1237 XGetWindowAttributes(dpy
, wwin
->client_win
, &attr
);
1239 if (wwin
== scr
->cmap_window
&& wwin
->cmap_window_no
== 0)
1240 scr
->current_colormap
= attr
.colormap
;
1243 } else if (event
->xcolormap
.state
== ColormapUninstalled
&&
1244 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1246 /* some bastard app (like XV) removed our colormap */
1248 * can't enforce or things like xscreensaver wont work
1251 } else if (event
->xcolormap
.state
== ColormapInstalled
&&
1252 scr
->current_colormap
== event
->xcolormap
.colormap
) {
1254 /* someone has put our colormap back */
1258 } while (XCheckTypedEvent(dpy
, ColormapNotify
, event
)
1259 && ((wwin
= wWindowFor(event
->xcolormap
.window
)) || 1));
1261 if (reinstall
&& scr
->current_colormap
!=None
) {
1262 if (!scr
->flags
.colormap_stuff_blocked
)
1263 XInstallColormap(dpy
, scr
->current_colormap
);
1270 handleFocusIn(XEvent
*event
)
1275 * For applications that like stealing the focus.
1277 while (XCheckTypedEvent(dpy
, FocusIn
, event
));
1278 saveTimestamp(event
);
1279 if (event
->xfocus
.mode
== NotifyUngrab
1280 || event
->xfocus
.mode
== NotifyGrab
1281 || event
->xfocus
.detail
> NotifyNonlinearVirtual
) {
1285 wwin
= wWindowFor(event
->xfocus
.window
);
1286 if (wwin
&& !wwin
->flags
.focused
) {
1287 if (wwin
->flags
.mapped
)
1288 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1290 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1292 WScreen
*scr
= wScreenForWindow(event
->xfocus
.window
);
1294 wSetFocusTo(scr
, NULL
);
1300 windowUnderPointer(WScreen
*scr
)
1306 if (XQueryPointer(dpy
, scr
->root_win
, &bar
, &win
, &foo
, &foo
, &foo
, &foo
,
1308 return wWindowFor(win
);
1316 handleKeyPress(XEvent
*event
)
1318 WScreen
*scr
= wScreenForRootWindow(event
->xkey
.root
);
1319 WWindow
*wwin
= scr
->focused_window
;
1322 int command
=-1, index
;
1323 #ifdef KEEP_XKB_LOCK_STATUS
1324 XkbStateRec staterec
;
1325 #endif /*KEEP_XKB_LOCK_STATUS*/
1327 /* ignore CapsLock */
1328 modifiers
= event
->xkey
.state
& ValidModMask
;
1330 for (i
=0; i
<WKBD_LAST
; i
++) {
1331 if (wKeyBindings
[i
].keycode
==0)
1334 if (wKeyBindings
[i
].keycode
==event
->xkey
.keycode
1335 && (/*wKeyBindings[i].modifier==0
1336 ||*/ wKeyBindings
[i
].modifier
==modifiers
)) {
1350 if (!wRootMenuPerformShortcut(event
)) {
1352 static int dontLoop
= 0;
1354 if (dontLoop
> 10) {
1355 wwarning("problem with key event processing code");
1359 /* if the focused window is an internal window, try redispatching
1360 * the event to the managed window, as it can be a WINGs window */
1361 if (wwin
&& wwin
->flags
.internal_window
1362 && wwin
->client_leader
!=None
) {
1363 /* client_leader contains the WINGs toplevel */
1364 event
->xany
.window
= wwin
->client_leader
;
1365 WMHandleEvent(event
);
1372 #define ISMAPPED(w) ((w) && !(w)->flags.miniaturized && ((w)->flags.mapped || (w)->flags.shaded))
1373 #define ISFOCUSED(w) ((w) && (w)->flags.focused)
1378 /*OpenRootMenu(scr, event->xkey.x_root, event->xkey.y_root, True);*/
1379 OpenRootMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, True
);
1381 case WKBD_WINDOWLIST
:
1382 /*OpenSwitchMenu(scr, event->xkey.x_root, event->xkey.y_root, True);*/
1383 OpenSwitchMenu(scr
, scr
->scr_width
/2, scr
->scr_height
/2, True
);
1386 case WKBD_WINDOWMENU
:
1387 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
))
1388 OpenWindowMenu(wwin
, wwin
->frame_x
,
1389 wwin
->frame_y
+wwin
->frame
->top_width
, True
);
1391 case WKBD_MINIATURIZE
:
1392 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)
1393 && !WFLAGP(wwin
, no_miniaturizable
)) {
1394 CloseWindowMenu(scr
);
1396 if (wwin
->protocols
.MINIATURIZE_WINDOW
)
1397 wClientSendProtocol(wwin
, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW
,
1398 event
->xbutton
.time
);
1400 wIconifyWindow(wwin
);
1405 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1406 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1407 CloseWindowMenu(scr
);
1409 if (wapp
&& !WFLAGP(wapp
->main_window_desc
, no_appicon
)) {
1410 wHideApplication(wapp
);
1415 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1416 CloseWindowMenu(scr
);
1418 if (wwin
->flags
.maximized
) {
1419 wUnmaximizeWindow(wwin
);
1421 wMaximizeWindow(wwin
, MAX_VERTICAL
|MAX_HORIZONTAL
);
1425 case WKBD_VMAXIMIZE
:
1426 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1427 CloseWindowMenu(scr
);
1429 if (wwin
->flags
.maximized
) {
1430 wUnmaximizeWindow(wwin
);
1432 wMaximizeWindow(wwin
, MAX_VERTICAL
);
1436 case WKBD_HMAXIMIZE
:
1437 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_resizable
)) {
1438 CloseWindowMenu(scr
);
1440 if (wwin
->flags
.maximized
) {
1441 wUnmaximizeWindow(wwin
);
1443 wMaximizeWindow(wwin
, MAX_HORIZONTAL
);
1448 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1449 CloseWindowMenu(scr
);
1451 wRaiseFrame(wwin
->frame
->core
);
1455 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1456 CloseWindowMenu(scr
);
1458 wLowerFrame(wwin
->frame
->core
);
1461 case WKBD_RAISELOWER
:
1462 /* raise or lower the window under the pointer, not the
1465 wwin
= windowUnderPointer(scr
);
1467 wRaiseLowerFrame(wwin
->frame
->core
);
1470 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_shadeable
)) {
1471 if (wwin
->flags
.shaded
)
1472 wUnshadeWindow(wwin
);
1477 case WKBD_MOVERESIZE
:
1478 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1479 CloseWindowMenu(scr
);
1481 wKeyboardMoveResizeWindow(wwin
);
1485 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
) && !WFLAGP(wwin
, no_closable
)) {
1486 CloseWindowMenu(scr
);
1487 if (wwin
->protocols
.DELETE_WINDOW
)
1488 wClientSendProtocol(wwin
, _XA_WM_DELETE_WINDOW
,
1493 if (ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1494 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1497 case WKBD_FOCUSNEXT
:
1498 StartWindozeCycle(wwin
, event
, True
);
1501 case WKBD_FOCUSPREV
:
1502 StartWindozeCycle(wwin
, event
, False
);
1505 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
1506 #define GOTOWORKS(wk) case WKBD_WORKSPACE##wk:\
1507 i = (scr->current_workspace/10)*10 + wk - 1;\
1508 if (wPreferences.ws_advance || i<scr->workspace_count)\
1509 wWorkspaceChange(scr, i);\
1512 #define GOTOWORKS(wk) case WKBD_WORKSPACE/**/wk:\
1513 i = (scr->current_workspace/10)*10 + wk - 1;\
1514 if (wPreferences.ws_advance || i<scr->workspace_count)\
1515 wWorkspaceChange(scr, i);\
1529 case WKBD_NEXTWORKSPACE
:
1530 wWorkspaceRelativeChange(scr
, 1);
1532 case WKBD_PREVWORKSPACE
:
1533 wWorkspaceRelativeChange(scr
, -1);
1546 index
= command
-WKBD_WINDOW1
;
1548 if (scr
->shortcutWindows
[index
]) {
1549 WMArray
*list
= scr
->shortcutWindows
[index
];
1551 int count
= WMGetArrayItemCount(list
);
1553 WMArrayIterator iter
;
1556 wUnselectWindows(scr
);
1557 cw
= scr
->current_workspace
;
1559 WM_ETARETI_ARRAY(list
, wwin
, iter
) {
1561 wWindowChangeWorkspace(wwin
, cw
);
1563 wMakeWindowVisible(wwin
);
1566 wSelectWindow(wwin
, True
);
1569 /* rotate the order of windows, to create a cycling effect */
1570 twin
= WMGetFromArray(list
, 0);
1571 WMDeleteFromArray(list
, 0);
1572 WMAddToArray(list
, twin
);
1574 } else if (wwin
&& ISMAPPED(wwin
) && ISFOCUSED(wwin
)) {
1575 if (scr
->shortcutWindows
[index
]) {
1576 WMFreeArray(scr
->shortcutWindows
[index
]);
1577 scr
->shortcutWindows
[index
] = NULL
;
1580 if (wwin
->flags
.selected
&& scr
->selected_windows
) {
1581 scr
->shortcutWindows
[index
] =
1582 WMDuplicateArray(scr
->selected_windows
);
1583 /*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
1584 WMInsertInArray(scr->shortcutWindows[index], 0, wwin);*/
1586 scr
->shortcutWindows
[index
] = WMCreateArray(4);
1587 WMAddToArray(scr
->shortcutWindows
[index
], wwin
);
1590 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1593 wSelectWindow(wwin
, !wwin
->flags
.selected
);
1596 } else if (scr
->selected_windows
1597 && WMGetArrayItemCount(scr
->selected_windows
)) {
1599 if (wwin
->flags
.selected
&& scr
->selected_windows
) {
1600 if (scr
->shortcutWindows
[index
]) {
1601 WMFreeArray(scr
->shortcutWindows
[index
]);
1603 scr
->shortcutWindows
[index
] =
1604 WMDuplicateArray(scr
->selected_windows
);
1610 case WKBD_SWITCH_SCREEN
:
1611 if (wScreenCount
> 1) {
1615 /* find index of this screen */
1616 for (i
= 0; i
< wScreenCount
; i
++) {
1617 if (wScreenWithNumber(i
) == scr
)
1621 if (i
>= wScreenCount
) {
1624 scr2
= wScreenWithNumber(i
);
1627 XWarpPointer(dpy
, scr
->root_win
, scr2
->root_win
, 0, 0, 0, 0,
1628 scr2
->scr_width
/2, scr2
->scr_height
/2);
1633 case WKBD_NEXTWSLAYER
:
1634 case WKBD_PREVWSLAYER
:
1638 row
= scr
->current_workspace
/10;
1639 column
= scr
->current_workspace
%10;
1641 if (command
==WKBD_NEXTWSLAYER
) {
1642 if ((row
+1)*10 < scr
->workspace_count
)
1643 wWorkspaceChange(scr
, column
+(row
+1)*10);
1646 wWorkspaceChange(scr
, column
+(row
-1)*10);
1650 case WKBD_CLIPLOWER
:
1651 if (!wPreferences
.flags
.noclip
)
1652 wDockLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1654 case WKBD_CLIPRAISE
:
1655 if (!wPreferences
.flags
.noclip
)
1656 wDockRaise(scr
->workspaces
[scr
->current_workspace
]->clip
);
1658 case WKBD_CLIPRAISELOWER
:
1659 if (!wPreferences
.flags
.noclip
)
1660 wDockRaiseLower(scr
->workspaces
[scr
->current_workspace
]->clip
);
1662 #ifdef KEEP_XKB_LOCK_STATUS
1664 if(wPreferences
.modelock
) {
1666 wwin
= scr
->focused_window
;
1668 if (wwin
&& wwin
->flags
.mapped
1669 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
1670 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
) {
1671 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1673 wwin
->frame
->languagemode
= wwin
->frame
->last_languagemode
;
1674 wwin
->frame
->last_languagemode
= staterec
.group
;
1675 XkbLockGroup(dpy
,XkbUseCoreKbd
, wwin
->frame
->languagemode
);
1680 #endif /* KEEP_XKB_LOCK_STATUS */
1687 handleMotionNotify(XEvent
*event
)
1690 WScreen
*scr
= wScreenForRootWindow(event
->xmotion
.root
);
1692 if (wPreferences
.scrollable_menus
) {
1693 if (scr
->flags
.jump_back_pending
||
1694 event
->xmotion
.x_root
<= 1 ||
1695 event
->xmotion
.x_root
>= (scr
->scr_width
- 2) ||
1696 event
->xmotion
.y_root
<= 1 ||
1697 event
->xmotion
.y_root
>= (scr
->scr_height
- 2)) {
1699 L("pointer at screen edge");
1701 menu
= wMenuUnderPointer(scr
);
1703 wMenuScroll(menu
, event
);
1707 if (event
->xmotion
.subwindow
== None
)
1710 if (scr
->scrolledFMaximize
!= None
) {
1713 twin
= wWindowFor(scr
->scrolledFMaximize
);
1714 if (twin
&& twin
->frame_y
==) {
1718 scr
->scrolledFMaximize
= NULL
;
1722 /* scroll full maximized window */
1723 if (event
->xmotion
.y_root
< 1
1724 || event
->xmotion
.y_root
> scr
->scr_height
- 1) {
1726 wwin
= wWindowFor(event
->xmotion
.subwindow
);
1728 if (wwin
&& (wwin
->flags
.maximized
& MAX_VERTICAL
)
1729 && WFLAGP(wwin
, full_maximize
)
1730 && event
->xmotion
.x_root
>= wwin
->frame_x
1731 && event
->xmotion
.x_root
<= wwin
->frame_x
+ wwin
->frame
->core
->width
) {
1733 if (!WFLAGP(wwin
, no_titlebar
)
1734 && wwin
->frame_y
<= - wwin
->frame
->top_width
) {
1736 wWindowMove(wwin
, wwin
->frame_x
, 0);
1737 wwin
->flags
.dragged_while_fmaximized
= 0;
1739 } else if (!WFLAGP(wwin
, no_resizebar
)
1740 && wwin
->frame_y
+ wwin
->frame
->core
->height
>=
1741 scr
->scr_height
+ wwin
->frame
->bottom_width
) {
1743 int y
= scr
->scr_height
+ wwin
->frame
->bottom_width
;
1745 y
= scr
->scr_height
- wwin
->frame_y
- wwin
->frame
->core
->height
;
1747 wWindowMove(wwin
, wwin
->frame_x
, y
);
1748 wwin
->flags
.dragged_while_fmaximized
= 0;
1757 handleVisibilityNotify(XEvent
*event
)
1761 wwin
= wWindowFor(event
->xvisibility
.window
);
1764 wwin
->flags
.obscured
=
1765 (event
->xvisibility
.state
== VisibilityFullyObscured
);