diff -r -u xfce-3.2.0/xfwm/events.c xfce-3.2.0.autodesk/xfwm/events.c --- xfce-3.2.0/xfwm/events.c Wed Nov 10 03:20:00 1999 +++ xfce-3.2.0.autodesk/xfwm/events.c Sun Nov 21 23:08:27 1999 @@ -63,6 +63,7 @@ #include "xfwm.h" #include #include "module.h" +#include unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); @@ -132,6 +133,7 @@ EventHandlerJumpTable[KeyPress] = HandleKeyPress; EventHandlerJumpTable[VisibilityNotify] = HandleVisibilityNotify; EventHandlerJumpTable[ColormapNotify] = HandleColormapNotify; + EventHandlerJumpTable[MotionNotify] = HandleMotionNotify; if (ShapesSupported) EventHandlerJumpTable[ShapeEventBase + ShapeNotify] = HandleShapeNotify; } @@ -406,6 +408,27 @@ { XTextProperty text_prop; + if (Event.xproperty.atom == _XA_WIN_WORKSPACE_COUNT) + { + Atom atype; + int aformat; + unsigned long nitems, bytes_remain; + unsigned char* prop; + + if ((XGetWindowProperty (dpy, Scr.Root, _XA_WIN_WORKSPACE_COUNT, 0L, 1L, False, + XA_CARDINAL, &atype, &aformat, &nitems, + &bytes_remain, &prop)) == Success) + { + if (prop != NULL) + { + Scr.ndesks = *(unsigned long *) prop; + syslog (LOG_DEBUG, __FUNCTION__">_WIN_WORKSPACE_COUNT=%i\n", Scr.ndesks); + } + } + + return; + } + if ((!Tmp_win) || (XGetGeometry (dpy, Tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0)) return; @@ -563,7 +586,6 @@ BroadcastConfig (M_CONFIGURE_WINDOW, Tmp_win); } break; - default: if (Event.xproperty.atom == _XA_WM_PROTOCOLS) FetchWmProtocols (Tmp_win); @@ -1282,6 +1304,102 @@ Tmp_win->flags &= ~RAISED; } } +} + +/*********************************************************************** + * + * Procedure: + * HandleRootMotionNotify - Root-MotionNotify event handler + * + ************************************************************************/ +int _xfwm_deskwrap (int horz, int vert) +{ + register int ndesks = Scr.ndesks; + register int desk = Scr.CurrentDesk; + + if (!ndesks) ndesks = 1; + + /*assumes that the desk-layout is alway 2 rows in height -gud */ + + if (horz) + { + desk += horz*2; + if (desk >= ndesks) { desk -= ndesks; } + if (desk < 0) { desk += ndesks; } + } + if (vert) + { + desk ^= 1; + } + + syslog (LOG_DEBUG, __FUNCTION__"> wrap to %i of %i\n", desk+1, ndesks); + return desk; +} + +void +HandleRootMotionNotify () +{ + if (Scr.SnapSize < 2) + { + return; + } + else + { /* check if the pointer is pushed onto the screen border, + if so, increment the corresponding X or Y counter (until Snapsize), + otherwise reset them to null. + */ + if (Event.xmotion.x_root == 0) { Scr.EdgeScrollX--; } + else if (Event.xmotion.y_root == 0) { Scr.EdgeScrollY--; } + else if (Event.xmotion.x_root >= Scr.MyDisplayWidth-1) { Scr.EdgeScrollX++; } + else if (Event.xmotion.y_root >= Scr.MyDisplayHeight-1) { Scr.EdgeScrollY++; } + else { Scr.EdgeScrollY = Scr.EdgeScrollX = 0; } + + /* now check if some EdgeCounter has reached Snapsize, so that + we shall emit signals to switch to the next desk (computed in + the deskwrap-helper) + */ + if (Scr.EdgeScrollX <= -Scr.SnapSize) + { /* move desktop left */ + changeDesks (0, _xfwm_deskwrap(-1,0)); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, +(Scr.MyDisplayWidth-Scr.SnapSize),(0)); + }else + if (Scr.EdgeScrollX >= +Scr.SnapSize) + { /* move desktop right */ + changeDesks (0, _xfwm_deskwrap(+1,0)); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, -(Scr.MyDisplayWidth-Scr.SnapSize),(0)); + }else + if (Scr.EdgeScrollY <= -Scr.SnapSize) + { /* move desktop upper */ + changeDesks (0, _xfwm_deskwrap(0,-1)); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, (0),+(Scr.MyDisplayHeight-Scr.SnapSize)); + }else + if (Scr.EdgeScrollY >= +Scr.SnapSize) + { /* move desktop lower */ + changeDesks (0, _xfwm_deskwrap(0,+1)); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, (0),-(Scr.MyDisplayHeight-Scr.SnapSize)); + } + } +} + +/*********************************************************************** + * + * Procedure: + * HandleMotionNotify - MotionNotify event handler + * + ************************************************************************/ +void +HandleMotionNotify () +{ + /* multi screen? */ + if (Event.xany.window == Scr.Root) + { + HandleRootMotionNotify (); + } + return; } /*************************************************************************** diff -r -u xfce-3.2.0/xfwm/move.c xfce-3.2.0.autodesk/xfwm/move.c --- xfce-3.2.0/xfwm/move.c Wed Nov 10 03:20:00 1999 +++ xfce-3.2.0.autodesk/xfwm/move.c Sun Nov 21 23:00:37 1999 @@ -30,6 +30,8 @@ extern XfwmWindow *Tmp_win; /* the current xfwm window */ Bool NeedToResizeToo; +/*forward*/ void XFwmMoveWindow (XfwmWindow* tmp_win, int xl, int yt); + /**************************************************************************** * * Start a window move operation @@ -218,7 +220,7 @@ } else - XMoveWindow (dpy, tmp_win->frame, xl, yt); + XFwmMoveWindow (tmp_win, xl, yt); } done = TRUE; break; @@ -376,3 +378,76 @@ UngrabEm (); } + +void +XFwmMoveWindow (XfwmWindow* tmp_win, int xl, int yt) +{ + extern int _xfwm_deskwrap (int x_off, int y_off); + if (Scr.SnapSize < 4) + { /* do the standard stuff */ + XMoveWindow (dpy, tmp_win->frame, xl, yt); + return; + } + else + { /* check if the pointer is pushed onto the screen border, + if so, increment the corresponding X or Y counter (until Snapsize), + otherwise reset them to null. + */ + if (Event.xmotion.x_root == 0) { Scr.EdgeScrollX--; } + else if (Event.xmotion.y_root == 0) { Scr.EdgeScrollY--; } + else if (Event.xmotion.x_root >= Scr.MyDisplayWidth-1) { Scr.EdgeScrollX++; } + else if (Event.xmotion.y_root >= Scr.MyDisplayHeight-1) { Scr.EdgeScrollY++; } + else { Scr.EdgeScrollY = Scr.EdgeScrollX = 0; } + + /* now check if some EdgeCounter has reached Snapsize, so that + we shall emit signals to switch to the next desk (computed in + the deskwrap-helper) + */ + if (Scr.EdgeScrollX <= -Scr.SnapSize) + { /* move desktop left */ + // UnmapIt (tmp_win); + tmp_win->Desk = _xfwm_deskwrap(-1,0); + XMoveWindow (dpy, tmp_win->frame, xl+(Scr.MyDisplayWidth-Scr.SnapSize),(yt)); + BroadcastConfig (M_CONFIGURE_WINDOW, tmp_win); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, +(Scr.MyDisplayWidth-Scr.SnapSize),(0)); + changeDesks (0, tmp_win->Desk); + }else + if (Scr.EdgeScrollX >= +Scr.SnapSize) + { /* move desktop right */ + // UnmapIt (tmp_win); + tmp_win->Desk = _xfwm_deskwrap(+1,0); + XMoveWindow (dpy, tmp_win->frame, xl-(Scr.MyDisplayWidth-Scr.SnapSize),(yt)); + BroadcastConfig (M_CONFIGURE_WINDOW, tmp_win); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, -(Scr.MyDisplayWidth-Scr.SnapSize),(0)); + changeDesks (0, tmp_win->Desk); + }else + if (Scr.EdgeScrollY <= -Scr.SnapSize) + { /* move desktop upper */ + // UnmapIt (tmp_win); + tmp_win->Desk = _xfwm_deskwrap(0,-1); + XMoveWindow (dpy, tmp_win->frame, (xl), yt+(Scr.MyDisplayHeight-Scr.SnapSize)); + BroadcastConfig (M_CONFIGURE_WINDOW, tmp_win); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, (0),+(Scr.MyDisplayHeight-Scr.SnapSize)); + changeDesks (0, tmp_win->Desk); + }else + if (Scr.EdgeScrollY >= +Scr.SnapSize) + { /* move desktop lower */ + // UnmapIt (tmp_win); + tmp_win->Desk = _xfwm_deskwrap(0,+1); + XMoveWindow (dpy, tmp_win->frame, (xl), yt-(Scr.MyDisplayHeight-Scr.SnapSize)); + BroadcastConfig (M_CONFIGURE_WINDOW, tmp_win); + Scr.EdgeScrollX = Scr.EdgeScrollY = 0; + XWarpPointer (dpy, None, None, 0,0,0,0, (0),-(Scr.MyDisplayHeight-Scr.SnapSize)); + changeDesks (0, tmp_win->Desk); + } + else + { + XMoveWindow (dpy, tmp_win->frame, xl, yt); + } + } +} + + diff -r -u xfce-3.2.0/xfwm/screen.h xfce-3.2.0.autodesk/xfwm/screen.h --- xfce-3.2.0/xfwm/screen.h Wed Nov 10 03:20:00 1999 +++ xfce-3.2.0.autodesk/xfwm/screen.h Sun Nov 21 18:41:01 1999 @@ -294,6 +294,9 @@ int ClickToFocusPassesClick; int SnapSize; unsigned int Options; + + /* AutoDeskSwitch */ + int ndesks; } ScreenInfo; diff -r -u xfce-3.2.0/xfwm/xfwm.c xfce-3.2.0.autodesk/xfwm/xfwm.c --- xfce-3.2.0/xfwm/xfwm.c Wed Nov 10 03:20:00 1999 +++ xfce-3.2.0.autodesk/xfwm/xfwm.c Sun Nov 21 23:10:03 1999 @@ -48,6 +48,7 @@ #include #endif +#include #define MAXHOSTNAME 255 @@ -364,6 +365,7 @@ LeaveWindowMask | EnterWindowMask | PropertyChangeMask | SubstructureRedirectMask | KeyPressMask | SubstructureNotifyMask | + PointerMotionMask | /* AutoDeskSwitch */ ButtonPressMask | ButtonReleaseMask); XSync (dpy, 0); @@ -975,6 +977,8 @@ Atom _XA_OL_DECOR_RESIZE; Atom _XA_OL_DECOR_HEADER; Atom _XA_OL_DECOR_ICON_NAME; +Atom _XA_WIN_WORKSPACE_COUNT; +Atom _XA_WIN_WORKSPACE; static void InternUsefulAtoms (void) @@ -1006,6 +1010,9 @@ _XA_OL_DECOR_HEADER = XInternAtom (dpy, "_OL_DECOR_HEADER", False); _XA_OL_DECOR_ICON_NAME = XInternAtom (dpy, "_OL_DECOR_ICON_NAME", False); + _XA_WIN_WORKSPACE_COUNT = XInternAtom (dpy, "_WIN_WORKSPACE_COUNT", False); + _XA_WIN_WORKSPACE = XInternAtom (dpy, "_WIN_WORKSPACE", False); + return; } @@ -1425,6 +1432,7 @@ Scr.IconFont.font = NULL; Scr.IconFont.fontset = NULL; + Scr.ndesks = 4; Scr.VxMax = 2 * Scr.MyDisplayWidth; Scr.VyMax = 2 * Scr.MyDisplayHeight; Scr.Vx = Scr.Vy = 0; @@ -1443,6 +1451,31 @@ { Restarting = True; Scr.CurrentDesk = *(unsigned long *) prop; + } + } + /* The gnome-compatible properties shall override others -gud */ + if ((XGetWindowProperty (dpy, Scr.Root, _XA_WIN_WORKSPACE, 0L, 1L, False, + XA_CARDINAL, &atype, &aformat, &nitems, + &bytes_remain, &prop)) == Success) + { + if (prop != NULL) + { + Restarting = True; + Scr.CurrentDesk = *(unsigned long *) prop; + if (Scr.CurrentDesk > 10) Scr.CurrentDesk = 1; + syslog (LOG_DEBUG, __FUNCTION__">_WIN_WORKSPACE=%i\n", Scr.CurrentDesk); + } + } + if ((XGetWindowProperty (dpy, Scr.Root, _XA_WIN_WORKSPACE_COUNT, 0L, 1L, False, + XA_CARDINAL, &atype, &aformat, &nitems, + &bytes_remain, &prop)) == Success) + { + if (prop != NULL) + { + Restarting = True; + Scr.ndesks = *(unsigned long *) prop; + if (Scr.ndesks > 10) Scr.ndesks = 10; + syslog (LOG_DEBUG, __FUNCTION__">_WIN_WORKSPACE_COUNT=%i\n", Scr.ndesks); } } } diff -r -u xfce-3.2.0/xfwm/xfwm.h xfce-3.2.0.autodesk/xfwm/xfwm.h --- xfce-3.2.0/xfwm/xfwm.h Wed Nov 10 03:20:00 1999 +++ xfce-3.2.0.autodesk/xfwm/xfwm.h Sun Nov 21 20:14:37 1999 @@ -317,6 +317,8 @@ extern Atom _XA_OL_DECOR_RESIZE; extern Atom _XA_OL_DECOR_HEADER; extern Atom _XA_OL_DECOR_ICON_NAME; +extern Atom _XA_WIN_WORKSPACE_COUNT; +extern Atom _XA_WIN_WORKSPACE; extern unsigned int KeyMask; extern unsigned int ButtonMask;