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
)
450 if (wShapeSupported
&& event
->type
== (wShapeEventBase
+ShapeNotify
)) {
451 handleShapeNotify(event
);
454 #ifdef KEEP_XKB_LOCK_STATUS
455 if (wPreferences
.modelock
&& event
->type
== (0x50|XkbIndicatorStateNotify
)){
456 /* if someone know how to call this 0x50
457 * or how to clean code this please tell ]d */
458 handleXkbIndicatorStateNotify(event
);
460 #endif /*KEEP_XKB_LOCK_STATUS*/
465 handleMapRequest(XEvent
*ev
)
469 Window window
= ev
->xmaprequest
.window
;
472 printf("got map request for %x\n", (unsigned)window
);
475 if ((wwin
= wWindowFor(window
))) {
476 if (wwin
->flags
.shaded
) {
477 wUnshadeWindow(wwin
);
479 /* deiconify window */
480 if (wwin
->flags
.miniaturized
) {
481 wDeiconifyWindow(wwin
);
482 } else if (wwin
->flags
.hidden
) {
483 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
484 /* go to the last workspace that the user worked on the app */
485 #ifndef REDUCE_APPICONS
486 /* This severely breaks REDUCE_APPICONS. last_workspace is a neat
487 * concept but it needs to be reworked to handle REDUCE_APPICONS -cls
490 wWorkspaceChange(wwin
->screen_ptr
, wapp
->last_workspace
);
493 wUnhideApplication(wapp
, False
, False
);
498 scr
= wScreenForRootWindow(ev
->xmaprequest
.parent
);
500 wwin
= wManageWindow(scr
, window
);
503 * This is to let the Dock know that the application it launched
504 * has already been mapped (eg: it has finished launching).
505 * It is not necessary for normally docked apps, but is needed for
506 * apps that were forcedly docked (like with dockit).
508 if (scr
->last_dock
) {
509 if (wwin
&& wwin
->main_window
!=None
&& wwin
->main_window
!=window
)
510 wDockTrackWindowLaunch(scr
->last_dock
, wwin
->main_window
);
512 wDockTrackWindowLaunch(scr
->last_dock
, window
);
516 wClientSetState(wwin
, NormalState
, None
);
517 if (wwin
->flags
.maximized
) {
518 wMaximizeWindow(wwin
, wwin
->flags
.maximized
);
520 if (wwin
->flags
.shaded
) {
521 wwin
->flags
.shaded
= 0;
522 wwin
->flags
.skip_next_animation
= 1;
525 if (wwin
->flags
.miniaturized
) {
526 wwin
->flags
.miniaturized
= 0;
527 wwin
->flags
.skip_next_animation
= 1;
528 wIconifyWindow(wwin
);
530 if (wwin
->flags
.hidden
) {
531 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
533 wwin
->flags
.hidden
= 0;
534 wwin
->flags
.skip_next_animation
= 1;
536 wHideApplication(wapp
);
544 handleDestroyNotify(XEvent
*event
)
548 Window window
= event
->xdestroywindow
.window
;
551 puts("got destroy notify");
554 wwin
= wWindowFor(window
);
556 wUnmanageWindow(wwin
, False
, True
);
559 app
= wApplicationOf(window
);
561 if (window
== app
->main_window
) {
563 wwin
= app
->main_window_desc
->screen_ptr
->focused_window
;
565 if (wwin
->main_window
== window
) {
566 wwin
->main_window
= None
;
571 wApplicationDestroy(app
);
575 wKWMCheckDestroy(&event
->xdestroywindow
);
582 handleExpose(XEvent
*event
)
584 WObjDescriptor
*desc
;
591 while (XCheckTypedWindowEvent(dpy
, event
->xexpose
.window
, Expose
, &ev
));
593 if (XFindContext(dpy
, event
->xexpose
.window
, wWinContext
,
594 (XPointer
*)&desc
)==XCNOENT
) {
598 if (desc
->handle_expose
) {
599 (*desc
->handle_expose
)(desc
, event
);
606 handleButtonPress(XEvent
*event
)
608 WObjDescriptor
*desc
;
612 puts("got button press");
615 scr
= wScreenForRootWindow(event
->xbutton
.root
);
623 if (event
->xbutton
.window
==scr
->root_win
) {
625 if (event
->xbutton
.button
==wPreferences
.menu_button
) {
626 OpenRootMenu(scr
, event
->xbutton
.x_root
,
627 event
->xbutton
.y_root
, False
);
629 if (scr
->root_menu
) {
630 if (scr
->root_menu
->brother
->flags
.mapped
)
631 event
->xbutton
.window
= scr
->root_menu
->brother
->frame
->core
->window
;
633 event
->xbutton
.window
= scr
->root_menu
->frame
->core
->window
;
635 } else if (event
->xbutton
.button
==wPreferences
.windowl_button
) {
636 OpenSwitchMenu(scr
, event
->xbutton
.x_root
,
637 event
->xbutton
.y_root
, False
);
638 if (scr
->switch_menu
) {
639 if (scr
->switch_menu
->brother
->flags
.mapped
)
640 event
->xbutton
.window
= scr
->switch_menu
->brother
->frame
->core
->window
;
642 event
->xbutton
.window
= scr
->switch_menu
->frame
->core
->window
;
644 } else if (event
->xbutton
.button
==wPreferences
.select_button
) {
645 wUnselectWindows(scr
);
646 wSelectWindows(scr
, event
);
648 #ifdef MOUSE_WS_SWITCH
649 else if (event
->xbutton
.button
==Button5
) {
651 wWorkspaceRelativeChange(scr
, -1);
653 } else if (event
->xbutton
.button
==Button4
) {
655 wWorkspaceRelativeChange(scr
, 1);
658 #endif /* MOUSE_WS_SWITCH */
660 else if (wGNOMEProxyizeButtonEvent(scr
, event
))
666 if (XFindContext(dpy
, event
->xbutton
.subwindow
, wWinContext
,
667 (XPointer
*)&desc
)==XCNOENT
) {
668 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
669 (XPointer
*)&desc
)==XCNOENT
) {
674 if (desc
->handle_mousedown
!=NULL
) {
675 (*desc
->handle_mousedown
)(desc
, event
);
678 if (desc
->parent_type
== WCLASS_WINDOW
) {
681 if (event
->xbutton
.state
& MOD_MASK
) {
682 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
685 if (wPreferences
.focus_mode
== WKF_CLICK
) {
686 if (wPreferences
.ignore_focus_click
) {
687 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
689 XAllowEvents(dpy
, ReplayPointer
, CurrentTime
);
692 } else if (desc
->parent_type
== WCLASS_APPICON
693 || desc
->parent_type
== WCLASS_MINIWINDOW
694 || desc
->parent_type
== WCLASS_DOCK_ICON
) {
695 if (event
->xbutton
.state
& MOD_MASK
) {
697 XAllowEvents(dpy
, AsyncPointer
, CurrentTime
);
702 /* save double-click information */
703 if (scr
->flags
.next_click_is_not_double
) {
704 scr
->flags
.next_click_is_not_double
= 0;
706 scr
->last_click_time
= event
->xbutton
.time
;
707 scr
->last_click_button
= event
->xbutton
.button
;
708 scr
->last_click_window
= event
->xbutton
.window
;
714 handleMapNotify(XEvent
*event
)
722 wwin
= wWindowFor(event
->xmap
.event
);
723 if (wwin
&& wwin
->client_win
== event
->xmap
.event
) {
724 if (wwin
->flags
.miniaturized
) {
725 wDeiconifyWindow(wwin
);
729 wClientSetState(wwin
, NormalState
, None
);
737 handleUnmapNotify(XEvent
*event
)
741 Bool withdraw
= False
;
747 /* only process windows with StructureNotify selected
748 * (ignore SubstructureNotify) */
749 wwin
= wWindowFor(event
->xunmap
.window
);
753 /* whether the event is a Withdrawal request */
754 if (event
->xunmap
.event
== wwin
->screen_ptr
->root_win
755 && event
->xunmap
.send_event
)
758 if (wwin
->client_win
!= event
->xunmap
.event
&& !withdraw
)
761 if (!wwin
->flags
.mapped
&& !withdraw
762 && wwin
->frame
->workspace
== wwin
->screen_ptr
->current_workspace
763 && !wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
)
767 XUnmapWindow(dpy
, wwin
->frame
->core
->window
);
768 wwin
->flags
.mapped
= 0;
770 /* check if the window was destroyed */
771 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, DestroyNotify
,&ev
)) {
774 Bool reparented
= False
;
776 if (XCheckTypedWindowEvent(dpy
, wwin
->client_win
, ReparentNotify
, &ev
))
779 /* withdraw window */
780 wwin
->flags
.mapped
= 0;
782 wClientSetState(wwin
, WithdrawnState
, None
);
784 /* if the window was reparented, do not reparent it back to the
786 wUnmanageWindow(wwin
, !reparented
, False
);
793 handleConfigureRequest(XEvent
*event
)
798 puts("got configure request");
800 if (!(wwin
=wWindowFor(event
->xconfigurerequest
.window
))) {
802 * Configure request for unmapped window
804 wClientConfigure(NULL
, &(event
->xconfigurerequest
));
806 wClientConfigure(wwin
, &(event
->xconfigurerequest
));
812 handlePropertyNotify(XEvent
*event
)
822 puts("got property notify");
824 if ((wwin
=wWindowFor(event
->xproperty
.window
))) {
825 if (!XGetGeometry(dpy
, wwin
->client_win
, &jr
, &ji
, &ji
,
826 &ju
, &ju
, &ju
, &ju
)) {
829 wClientCheckProperty(wwin
, &event
->xproperty
);
831 wapp
= wApplicationOf(event
->xproperty
.window
);
833 wClientCheckProperty(wapp
->main_window_desc
, &event
->xproperty
);
836 scr
= wScreenForWindow(event
->xproperty
.window
);
837 if (scr
&& scr
->root_win
== event
->xproperty
.window
) {
839 wKWMCheckRootHintChange(scr
, &event
->xproperty
);
846 handleClientMessage(XEvent
*event
)
849 WObjDescriptor
*desc
;
852 puts("got client message");
854 /* handle transition from Normal to Iconic state */
855 if (event
->xclient
.message_type
== _XA_WM_CHANGE_STATE
856 && event
->xclient
.format
== 32
857 && event
->xclient
.data
.l
[0] == IconicState
) {
859 wwin
= wWindowFor(event
->xclient
.window
);
861 if (!wwin
->flags
.miniaturized
)
862 wIconifyWindow(wwin
);
863 } else if (event
->xclient
.message_type
== _XA_WM_COLORMAP_NOTIFY
864 && event
->xclient
.format
== 32) {
865 WScreen
*scr
= wScreenSearchForRootWindow(event
->xclient
.window
);
870 if (event
->xclient
.data
.l
[1] == 1) { /* starting */
871 wColormapAllowClientInstallation(scr
, True
);
872 } else { /* stopping */
873 wColormapAllowClientInstallation(scr
, False
);
875 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_COMMAND
) {
877 wDefaultsCheckDomains("bla");
879 } else if (event
->xclient
.message_type
== _XA_WINDOWMAKER_WM_FUNCTION
) {
882 wapp
= wApplicationOf(event
->xclient
.window
);
884 switch (event
->xclient
.data
.l
[0]) {
885 case WMFHideOtherApplications
:
886 wHideOtherApplications(wapp
->main_window_desc
);
890 case WMFHideApplication
:
891 wHideApplication(wapp
);
897 wwin
= wWindowFor(event
->xclient
.window
);
899 switch (event
->xclient
.data
.l
[0]) {
900 case WMFHideOtherApplications
:
901 wHideOtherApplications(wwin
);
904 case WMFHideApplication
:
905 wHideApplication(wApplicationOf(wwin
->main_window
));
911 } else if (wGNOMEProcessClientMessage(&event
->xclient
)) {
913 #endif /* GNOME_STUFF */
915 } else if (wKWMProcessClientMessage(&event
->xclient
)) {
917 #endif /* KWM_HINTS */
919 } else if (wXDNDProcessClientMessage(&event
->xclient
)) {
923 } else if (event
->xclient
.message_type
==_XA_DND_PROTOCOL
) {
924 WScreen
*scr
= wScreenForWindow(event
->xclient
.window
);
925 if (scr
&& wDockReceiveDNDDrop(scr
,event
))
926 goto redirect_message
;
927 #endif /* OFFIX_DND */
933 * Non-standard thing, but needed by OffiX DND.
934 * For when the icon frame gets a ClientMessage
935 * that should have gone to the icon_window.
937 if (XFindContext(dpy
, event
->xbutton
.window
, wWinContext
,
938 (XPointer
*)&desc
)!=XCNOENT
) {
939 struct WIcon
*icon
=NULL
;
941 if (desc
->parent_type
== WCLASS_MINIWINDOW
) {
942 icon
= (WIcon
*)desc
->parent
;
943 } else if (desc
->parent_type
== WCLASS_DOCK_ICON
944 || desc
->parent_type
== WCLASS_APPICON
) {
945 icon
= ((WAppIcon
*)desc
->parent
)->icon
;
947 if (icon
&& (wwin
=icon
->owner
)) {
948 if (wwin
->client_win
!=event
->xclient
.window
) {
949 event
->xclient
.window
= wwin
->client_win
;
950 XSendEvent(dpy
, wwin
->client_win
, False
, NoEventMask
,
960 raiseWindow(WScreen
*scr
)
964 scr
->autoRaiseTimer
= NULL
;
966 wwin
= wWindowFor(scr
->autoRaiseWindow
);
970 if (!wwin
->flags
.destroyed
) {
971 wRaiseFrame(wwin
->frame
->core
);
972 /* this is needed or a race condition will occur */
979 handleEnterNotify(XEvent
*event
)
982 WObjDescriptor
*desc
= NULL
;
984 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
988 puts("got enter notify");
991 if (XCheckTypedWindowEvent(dpy
, event
->xcrossing
.window
, LeaveNotify
,
993 /* already left the window... */
995 if (ev
.xcrossing
.mode
==event
->xcrossing
.mode
996 && ev
.xcrossing
.detail
==event
->xcrossing
.detail
) {
1001 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1002 (XPointer
*)&desc
)!=XCNOENT
) {
1003 if(desc
->handle_enternotify
)
1004 (*desc
->handle_enternotify
)(desc
, event
);
1007 /* enter to window */
1008 wwin
= wWindowFor(event
->xcrossing
.window
);
1010 if (wPreferences
.focus_mode
==WKF_POINTER
1011 && event
->xcrossing
.window
==event
->xcrossing
.root
) {
1012 wSetFocusTo(scr
, NULL
);
1014 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1015 wColormapInstallForWindow(scr
, NULL
);
1017 if (scr
->autoRaiseTimer
1018 && event
->xcrossing
.root
==event
->xcrossing
.window
) {
1019 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1020 scr
->autoRaiseTimer
= NULL
;
1023 /* set auto raise timer even if in focus-follows-mouse mode
1024 * and the event is for the frame window, even if the window
1025 * has focus already. useful if you move the pointer from a focused
1026 * window to the root window and back pretty fast
1028 * set focus if in focus-follows-mouse mode and the event
1029 * is for the frame window and window doesn't have focus yet */
1030 if ((wPreferences
.focus_mode
==WKF_POINTER
1031 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1032 && wwin
->frame
->core
->window
==event
->xcrossing
.window
1033 && !scr
->flags
.doing_alt_tab
) {
1035 if (!wwin
->flags
.focused
&& !WFLAGP(wwin
, no_focusable
))
1036 wSetFocusTo(scr
, wwin
);
1038 if (scr
->autoRaiseTimer
)
1039 WMDeleteTimerHandler(scr
->autoRaiseTimer
);
1040 scr
->autoRaiseTimer
= NULL
;
1042 if (wPreferences
.raise_delay
&& !WFLAGP(wwin
, no_focusable
)) {
1043 scr
->autoRaiseWindow
= wwin
->frame
->core
->window
;
1045 = WMAddTimerHandler(wPreferences
.raise_delay
,
1046 (WMCallback
*)raiseWindow
, scr
);
1049 /* Install colormap for window, if the colormap installation mode
1050 * is colormap_follows_mouse */
1051 if (wPreferences
.colormap_mode
==WKF_POINTER
) {
1052 if (wwin
->client_win
==event
->xcrossing
.window
)
1053 wColormapInstallForWindow(scr
, wwin
);
1055 wColormapInstallForWindow(scr
, NULL
);
1059 /* a little kluge to hide the clip balloon */
1060 if (!wPreferences
.flags
.noclip
&& scr
->flags
.clip_balloon_mapped
) {
1062 XUnmapWindow(dpy
, scr
->clip_balloon
);
1063 scr
->flags
.clip_balloon_mapped
= 0;
1065 if (desc
->parent_type
!=WCLASS_DOCK_ICON
1066 || scr
->clip_icon
!= desc
->parent
) {
1067 XUnmapWindow(dpy
, scr
->clip_balloon
);
1068 scr
->flags
.clip_balloon_mapped
= 0;
1073 if (event
->xcrossing
.window
== event
->xcrossing
.root
1074 && event
->xcrossing
.detail
== NotifyNormal
1075 && event
->xcrossing
.detail
!= NotifyInferior
1076 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1078 wSetFocusTo(scr
, scr
->focused_window
);
1082 wBalloonEnteredObject(scr
, desc
);
1088 handleLeaveNotify(XEvent
*event
)
1090 WObjDescriptor
*desc
= NULL
;
1092 if (XFindContext(dpy
, event
->xcrossing
.window
, wWinContext
,
1093 (XPointer
*)&desc
)!=XCNOENT
) {
1094 if(desc
->handle_leavenotify
)
1095 (*desc
->handle_leavenotify
)(desc
, event
);
1097 if (event
->xcrossing
.window
== event
->xcrossing
.root
1098 && event
->xcrossing
.mode
== NotifyNormal
1099 && event
->xcrossing
.detail
!= NotifyInferior
1100 && wPreferences
.focus_mode
!= WKF_CLICK
) {
1102 WScreen
*scr
= wScreenForRootWindow(event
->xcrossing
.root
);
1104 wSetFocusTo(scr
, NULL
);
1111 handleShapeNotify(XEvent
*event
)
1113 XShapeEvent
*shev
= (XShapeEvent
*)event
;
1118 puts("got shape notify");
1121 while (XCheckTypedWindowEvent(dpy
, shev
->window
, event
->type
, &ev
)) {
1122 XShapeEvent
*sev
= (XShapeEvent
*)&ev
;
1124 if (sev
->kind
== ShapeBounding
) {
1125 if (sev
->shaped
== shev
->shaped
) {
1128 XPutBackEvent(dpy
, &ev
);
1134 wwin
= wWindowFor(shev
->window
);
1135 if (!wwin
|| shev
->kind
!= ShapeBounding
)
1138 if (!shev
->shaped
&& wwin
->flags
.shaped
) {
1140 wwin
->flags
.shaped
= 0;
1141 wWindowClearShape(wwin
);
1143 } else if (shev
->shaped
) {
1145 wwin
->flags
.shaped
= 1;
1146 wWindowSetShape(wwin
);
1151 #ifdef KEEP_XKB_LOCK_STATUS
1152 /* please help ]d if you know what to do */
1153 handleXkbIndicatorStateNotify(XEvent
*event
)
1157 XkbStateRec staterec
;
1160 XkbGetState(dpy
,XkbUseCoreKbd
,&staterec
);
1161 for (i
=0; i
<wScreenCount
; i
++) {
1162 scr
= wScreenWithNumber(i
);
1163 wwin
= scr
->focused_window
;
1164 if (wwin
->flags
.focused
) {
1165 wwin
->frame
->languagemode
=staterec
.compat_state
&32?1:0;
1166 #ifdef XKB_BUTTON_HINT
1167 if (wwin
->frame
->titlebar
) {
1168 wFrameWindowPaint(wwin
->frame
);
1171 #ifdef XKB_TITLE_HINT
1172 if (wwin
->frame
->titlebar
) {
1173 XClearWindow(dpy
, wwin
->frame
->titlebar
->window
);
1174 wFrameWindowPaint(wwin
->frame
);
1176 #endif /* XKB_TITLE_HINT */
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
= staterec
.compat_state
&32
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
);