~profzoom/ubuntu/quantal/wmaker/bug-1079925

« back to all changes in this revision

Viewing changes to contrib/workspace_flip.patch

  • Committer: Bazaar Package Importer
  • Author(s): Marcelo E. Magallon
  • Date: 2004-11-10 14:05:30 UTC
  • Revision ID: james.westby@ubuntu.com-20041110140530-qpd66b5lm38x7apk
Tags: upstream-0.91.0
ImportĀ upstreamĀ versionĀ 0.91.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Naur WindowMaker-0.65.0/src/WindowMaker.h wmaker-workspaceflip/src/WindowMaker.h
 
2
--- WindowMaker-0.65.0/src/WindowMaker.h        Sat Apr 28 01:41:21 2001
 
3
+++ wmaker-workspaceflip/src/WindowMaker.h      Sun Aug 12 12:51:14 2001
 
4
@@ -397,6 +397,8 @@
 
5
 
 
6
     int raise_delay;                  /* delay for autoraise. 0 is disabled */
 
7
 
 
8
+    int workspace_flip_delay;         /* delay for workspace flipping, 0 is disabled */
 
9
+    
 
10
     int cmap_size;                    /* size of dithering colormap in colors
 
11
                                        * per channel */
 
12
 
 
13
diff -Naur WindowMaker-0.65.0/src/defaults.c wmaker-workspaceflip/src/defaults.c
 
14
--- WindowMaker-0.65.0/src/defaults.c   Fri May 11 00:16:49 2001
 
15
+++ wmaker-workspaceflip/src/defaults.c Sun Aug 12 12:51:14 2001
 
16
@@ -420,6 +420,9 @@
 
17
     {"RaiseDelay",     "0",                    NULL,
 
18
          &wPreferences.raise_delay,    getInt,         NULL
 
19
     },
 
20
+    {"WorkspaceFlipDelay",     "0",    NULL,
 
21
+         &wPreferences.workspace_flip_delay,   getInt,         NULL
 
22
+    },
 
23
     {"WindozeCycling",  "YES",                 NULL,
 
24
          &wPreferences.windows_cycling,getBool,        NULL
 
25
     },
 
26
diff -Naur WindowMaker-0.65.0/src/event.c wmaker-workspaceflip/src/event.c
 
27
--- WindowMaker-0.65.0/src/event.c      Sat Apr 28 01:41:21 2001
 
28
+++ wmaker-workspaceflip/src/event.c    Sun Aug 12 12:51:14 2001
 
29
@@ -1676,12 +1676,53 @@
 
30
     }
 
31
 }
 
32
 
 
33
+#define DEL_TIMER(timer) { \
 
34
+       WMDeleteTimerHandler(timer); \
 
35
+       timer = NULL; \
 
36
+}
 
37
+
 
38
+
 
39
+
 
40
+static void 
 
41
+flipRightWorkspace(void* data) 
 
42
+{
 
43
+       WScreen *scr = (WScreen*)data;
 
44
+       int x,y,tmp,last_workspace = scr->current_workspace;
 
45
+       Window tmpw;
 
46
+
 
47
+       DEL_TIMER(scr->workspace_flip_right_timer);
 
48
+
 
49
+       XQueryPointer(dpy,scr->root_win,&tmpw,&tmpw,&x,&y,&tmp,&tmp,&tmp);
 
50
+       if(x != scr->scr_width-1) return;
 
51
+       
 
52
+       wWorkspaceRelativeChange(scr, 1);
 
53
+       if(last_workspace != scr->current_workspace) 
 
54
+               XWarpPointer(dpy,None,scr->root_win,0,0,0,0,1,y);
 
55
+}
 
56
+
 
57
+static void 
 
58
+flipLeftWorkspace(void* data) 
 
59
+{
 
60
+       WScreen *scr = (WScreen*)data;
 
61
+       int x,y,tmp,last_workspace = scr->current_workspace;
 
62
+       Window tmpw;
 
63
+
 
64
+       DEL_TIMER(scr->workspace_flip_left_timer);
 
65
+       
 
66
+       XQueryPointer(dpy,scr->root_win,&tmpw,&tmpw,&x,&y,&tmp,&tmp,&tmp);
 
67
+       if(x != 0) return;
 
68
+
 
69
+       wWorkspaceRelativeChange(scr, -1);
 
70
+       if(last_workspace != scr->current_workspace)
 
71
+               XWarpPointer(dpy,None,scr->root_win,0,0,0,0,scr->scr_width-2,y);
 
72
+}
 
73
 
 
74
 static void 
 
75
 handleMotionNotify(XEvent *event)
 
76
 {
 
77
     WMenu *menu;
 
78
     WScreen *scr = wScreenForRootWindow(event->xmotion.root);
 
79
+       int left,right;
 
80
 
 
81
     if (wPreferences.scrollable_menus) {
 
82
         if (scr->flags.jump_back_pending ||
 
83
@@ -1697,6 +1738,29 @@
 
84
                 wMenuScroll(menu, event);
 
85
         }
 
86
     }
 
87
+
 
88
+       /* workspace flipping */
 
89
+       if(!wPreferences.workspace_flip_delay) return;
 
90
+
 
91
+       left  = (event->xmotion.x_root == 0);
 
92
+       right = (event->xmotion.x_root == scr->scr_width-1);
 
93
+
 
94
+       if(right && !scr->workspace_flip_right_timer) 
 
95
+               scr->workspace_flip_right_timer = 
 
96
+                       WMAddTimerHandler(wPreferences.workspace_flip_delay,
 
97
+                                                         flipRightWorkspace,scr);
 
98
+
 
99
+       if(left && !scr->workspace_flip_left_timer) 
 
100
+               scr->workspace_flip_left_timer = 
 
101
+                       WMAddTimerHandler(wPreferences.workspace_flip_delay,
 
102
+                                                         flipLeftWorkspace,scr);
 
103
+
 
104
+       if(!right && scr->workspace_flip_right_timer) 
 
105
+               DEL_TIMER(scr->workspace_flip_right_timer);
 
106
+
 
107
+       if(!left && scr->workspace_flip_left_timer) 
 
108
+               DEL_TIMER(scr->workspace_flip_left_timer);
 
109
+
 
110
 #if 0
 
111
     if (event->xmotion.subwindow == None)
 
112
        return;
 
113
diff -Naur WindowMaker-0.65.0/src/screen.h wmaker-workspaceflip/src/screen.h
 
114
--- WindowMaker-0.65.0/src/screen.h     Sun Apr 15 03:23:01 2001
 
115
+++ wmaker-workspaceflip/src/screen.h   Sun Aug 12 12:51:14 2001
 
116
@@ -273,6 +273,10 @@
 
117
     Window last_click_window;
 
118
     int last_click_button;
 
119
     
 
120
+       /* for workspace flipping when mouse hits edge */
 
121
+       WMHandlerID *workspace_flip_left_timer;
 
122
+       WMHandlerID *workspace_flip_right_timer;
 
123
+       
 
124
     /* balloon help data */
 
125
     struct _WBalloon *balloon;
 
126