/[oroborus]/oroborus/src/events.c
ViewVC logotype

Diff of /oroborus/src/events.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by dreamind, Sun Jul 7 03:17:41 2002 UTC revision 1.19 by dreamind, Mon Jul 15 08:23:07 2002 UTC
# Line 26  int raise_counter = -1; Line 26  int raise_counter = -1;
26  void  void
27  handleKeyPress (XKeyEvent * ev)  handleKeyPress (XKeyEvent * ev)
28  {  {
29    Client *c;          Client *c;
30    int state, key;          int state, key;
31    XEvent e;          XEvent e;
32    XWindowChanges wc;          XWindowChanges wc;
   
 #ifdef DEBUG  
   printf ("entering handleKeyEvent\n");  
 #endif  
   
   c = clientGetFocus ();  
   state = ev->state & (Mod1Mask | ControlMask | ShiftMask);  
   for (key = 0; key < KEY_COUNT; key++)  
     if (keys[key].keycode == ev->keycode && keys[key].modifier == state)  
       break;  
   
   if (c)  
     {  
       switch (key)  
         {  
         case KEY_QUIT:  
           quit = True;  
           break;  
         case KEY_MOVE_UP:  
         case KEY_MOVE_DOWN:  
         case KEY_MOVE_LEFT:  
         case KEY_MOVE_RIGHT:  
           clientMove (c, (XEvent *) ev);  
           clientWarpMouse (c);  
           break;  
         case KEY_TOP_LEFT:  
           wc.x = frameLeft (c) + margins[MARGIN_LEFT];  
           wc.y = frameTop (c) + margins[MARGIN_TOP];  
           clientConfigure (c, &wc, CWX | CWY);  
           clientWarpMouse (c);  
           break;  
         case KEY_TOP_RIGHT:  
           wc.x =  
             XDisplayWidth (dpy,  
                            screen) - c->width - frameRight (c) -  
             margins[MARGIN_RIGHT];  
           wc.y = frameTop (c) + margins[MARGIN_TOP];  
           clientConfigure (c, &wc, CWX | CWY);  
           clientWarpMouse (c);  
           break;  
         case KEY_BOTTOM_LEFT:  
           wc.x = frameLeft (c) + margins[MARGIN_LEFT];  
           wc.y =  
             XDisplayHeight (dpy,  
                             screen) - c->height - frameBottom (c) -  
             margins[MARGIN_BOTTOM];  
           clientConfigure (c, &wc, CWX | CWY);  
           clientWarpMouse (c);  
           break;  
         case KEY_BOTTOM_RIGHT:  
           wc.x =  
             XDisplayWidth (dpy,  
                            screen) - c->width - frameRight (c) -  
             margins[MARGIN_RIGHT];  
           wc.y =  
             XDisplayHeight (dpy,  
                             screen) - c->height - frameBottom (c) -  
             margins[MARGIN_BOTTOM];  
           clientConfigure (c, &wc, CWX | CWY);  
           clientWarpMouse (c);  
           break;  
         case KEY_RESIZE_UP:  
         case KEY_RESIZE_DOWN:  
         case KEY_RESIZE_LEFT:  
         case KEY_RESIZE_RIGHT:  
           clientResize (c, (XEvent *) ev);  
           clientWarpMouse (c);  
           break;  
         case KEY_CYCLE_WINDOWS:  
           clientCycle (c);  
           break;  
         case KEY_CLOSE_WINDOW:  
           clientClose (c);  
           break;  
         case KEY_HIDE_WINDOW:  
           clientHide (c, True);  
           break;  
         case KEY_MAXIMIZE_WINDOW:  
           clientToggleMaximized (c, WIN_STATE_MAXIMIZED);  
           clientWarpMouse (c);  
           break;  
         case KEY_MAXIMIZE_VERT:  
           clientToggleMaximized (c, WIN_STATE_MAXIMIZED_VERT);  
           clientWarpMouse (c);  
           break;  
         case KEY_MAXIMIZE_HORIZ:  
           clientToggleMaximized (c, WIN_STATE_MAXIMIZED_HORIZ);  
           clientWarpMouse (c);  
           break;  
         case KEY_SHADE_WINDOW:  
           clientToggleShaded (c);  
           break;  
         case KEY_RAISE_WINDOW_LAYER:  
           clientSetLayer (c, c->win_layer + 1);  
           break;  
         case KEY_LOWER_WINDOW_LAYER:  
           clientSetLayer (c, c->win_layer - 1);  
           break;  
         case KEY_NEXT_WORKSPACE:  
           workspaceSwitch (workspace + 1, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_PREV_WORKSPACE:  
           workspaceSwitch (workspace - 1, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_ADD_WORKSPACE:  
           workspaceSetCount (workspace_count + 1);  
           setNetWorkarea (margins, workspace_count);  
           break;  
         case KEY_DEL_WORKSPACE:  
           workspaceSetCount (workspace_count - 1);  
           setNetWorkarea (margins, workspace_count);  
           break;  
         case KEY_STICK_WINDOW:  
           clientToggleSticky (c);  
           break;  
         case KEY_WORKSPACE_1:  
           workspaceSwitch (0, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_2:  
           workspaceSwitch (1, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_3:  
           workspaceSwitch (2, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_4:  
           workspaceSwitch (3, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_5:  
           workspaceSwitch (4, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_6:  
           workspaceSwitch (5, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_7:  
           workspaceSwitch (6, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_8:  
           workspaceSwitch (7, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_9:  
           workspaceSwitch (8, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_NEXT_WORKSPACE:  
           workspaceSwitch (workspace + 1, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_PREV_WORKSPACE:  
           workspaceSwitch (workspace - 1, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_1:  
           workspaceSwitch (0, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_2:  
           workspaceSwitch (1, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_3:  
           workspaceSwitch (2, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_4:  
           workspaceSwitch (3, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_5:  
           workspaceSwitch (4, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_6:  
           workspaceSwitch (5, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_7:  
           workspaceSwitch (6, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_8:  
           workspaceSwitch (7, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_MOVE_WORKSPACE_9:  
           workspaceSwitch (8, c);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         }  
     }  
   else  
     {  
       switch (key)  
         {  
         case KEY_QUIT:  
           quit = True;  
           break;  
         case KEY_CYCLE_WINDOWS:  
           if (clients)  
             clientCycle (clients->prev);  
           break;  
         case KEY_NEXT_WORKSPACE:  
           workspaceSwitch (workspace + 1, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_PREV_WORKSPACE:  
           workspaceSwitch (workspace - 1, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_ADD_WORKSPACE:  
           workspaceSetCount (workspace_count + 1);  
           setNetWorkarea (margins, workspace_count);  
           break;  
         case KEY_DEL_WORKSPACE:  
           workspaceSetCount (workspace_count - 1);  
           setNetWorkarea (margins, workspace_count);  
           break;  
         case KEY_WORKSPACE_1:  
           workspaceSwitch (0, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_2:  
           workspaceSwitch (1, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_3:  
           workspaceSwitch (2, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_4:  
           workspaceSwitch (3, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_5:  
           workspaceSwitch (4, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_6:  
           workspaceSwitch (5, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_7:  
           workspaceSwitch (6, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_8:  
           workspaceSwitch (7, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         case KEY_WORKSPACE_9:  
           workspaceSwitch (8, NULL);  
           clientWarpMouse (clientGetFocus ());  
           break;  
         }  
     }  
33    
34    while (XCheckTypedEvent (dpy, EnterNotify, &e));  #ifdef DEBUG
35            printf ("entering handleKeyEvent\n");
36    #endif
37    
38            c = clientGetFocus ();
39            state = ev->state & (Mod1Mask | ControlMask | ShiftMask);
40            for (key = 0; key < KEY_COUNT; key++)
41                    if (keys[key].keycode == ev->keycode && keys[key].modifier == state)
42                            break;
43    
44            if (c)
45                    {
46                            switch (key)
47                                    {
48                                    case KEY_QUIT:
49                                            quit = True;
50                                            break;
51                                    case KEY_MOVE_UP:
52                                    case KEY_MOVE_DOWN:
53                                    case KEY_MOVE_LEFT:
54                                    case KEY_MOVE_RIGHT:
55                                            clientMove (c, (XEvent *) ev);
56                                            clientWarpMouse (c);
57                                            break;
58                                    case KEY_TOP_LEFT:
59                                            wc.x = frameLeft (c) + margins[MARGIN_LEFT];
60                                            wc.y = frameTop (c) + margins[MARGIN_TOP];
61                                            clientConfigure (c, &wc, CWX | CWY);
62                                            clientWarpMouse (c);
63                                            break;
64                                    case KEY_TOP_RIGHT:
65                                            wc.x =
66                                                    XDisplayWidth (dpy,
67                                                                                                             screen) - c->width - frameRight (c) -
68                                                    margins[MARGIN_RIGHT];
69                                            wc.y = frameTop (c) + margins[MARGIN_TOP];
70                                            clientConfigure (c, &wc, CWX | CWY);
71                                            clientWarpMouse (c);
72                                            break;
73                                    case KEY_BOTTOM_LEFT:
74                                            wc.x = frameLeft (c) + margins[MARGIN_LEFT];
75                                            wc.y =
76                                                    XDisplayHeight (dpy,
77                                                                                                                    screen) - c->height - frameBottom (c) -
78                                                    margins[MARGIN_BOTTOM];
79                                            clientConfigure (c, &wc, CWX | CWY);
80                                            clientWarpMouse (c);
81                                            break;
82                                    case KEY_BOTTOM_RIGHT:
83                                            wc.x =
84                                                    XDisplayWidth (dpy,
85                                                                                                             screen) - c->width - frameRight (c) -
86                                                    margins[MARGIN_RIGHT];
87                                            wc.y =
88                                                    XDisplayHeight (dpy,
89                                                                                                                    screen) - c->height - frameBottom (c) -
90                                                    margins[MARGIN_BOTTOM];
91                                            clientConfigure (c, &wc, CWX | CWY);
92                                            clientWarpMouse (c);
93                                            break;
94                                    case KEY_RESIZE_UP:
95                                    case KEY_RESIZE_DOWN:
96                                    case KEY_RESIZE_LEFT:
97                                    case KEY_RESIZE_RIGHT:
98                                            clientResize (c, (XEvent *) ev);
99                                            clientWarpMouse (c);
100                                            break;
101                                    case KEY_CYCLE_WINDOWS:
102                                            clientCycle (c);
103                                            break;
104                                    case KEY_CLOSE_WINDOW:
105                                            clientClose (c);
106                                            break;
107                                    case KEY_HIDE_WINDOW:
108                                            clientHide (c, True);
109                                            break;
110                                    case KEY_MAXIMIZE_WINDOW:
111                                            clientToggleMaximized (c, WIN_STATE_MAXIMIZED);
112                                            clientWarpMouse (c);
113                                            break;
114                                    case KEY_MAXIMIZE_VERT:
115                                            clientToggleMaximized (c, WIN_STATE_MAXIMIZED_VERT);
116                                            clientWarpMouse (c);
117                                            break;
118                                    case KEY_MAXIMIZE_HORIZ:
119                                            clientToggleMaximized (c, WIN_STATE_MAXIMIZED_HORIZ);
120                                            clientWarpMouse (c);
121                                            break;
122                                    case KEY_SHADE_WINDOW:
123                                            clientToggleShaded (c);
124                                            break;
125                                    case KEY_RAISE_WINDOW_LAYER:
126                                            clientSetLayer (c, c->win_layer + 1);
127                                            break;
128                                    case KEY_LOWER_WINDOW_LAYER:
129                                            clientSetLayer (c, c->win_layer - 1);
130                                            break;
131                                    case KEY_NEXT_WORKSPACE:
132                                            workspaceSwitch (workspace + 1, NULL);
133                                            clientWarpMouse (clientGetFocus ());
134                                            break;
135                                    case KEY_PREV_WORKSPACE:
136                                            workspaceSwitch (workspace - 1, NULL);
137                                            clientWarpMouse (clientGetFocus ());
138                                            break;
139                                    case KEY_ADD_WORKSPACE:
140                                            workspaceSetCount (workspace_count + 1);
141                                            setNetWorkarea (margins, workspace_count);
142                                            break;
143                                    case KEY_DEL_WORKSPACE:
144                                            workspaceSetCount (workspace_count - 1);
145                                            setNetWorkarea (margins, workspace_count);
146                                            break;
147                                    case KEY_STICK_WINDOW:
148                                            clientToggleSticky (c);
149                                            break;
150                                    case KEY_WORKSPACE_1:
151                                            workspaceSwitch (0, NULL);
152                                            clientWarpMouse (clientGetFocus ());
153                                            break;
154                                    case KEY_WORKSPACE_2:
155                                            workspaceSwitch (1, NULL);
156                                            clientWarpMouse (clientGetFocus ());
157                                            break;
158                                    case KEY_WORKSPACE_3:
159                                            workspaceSwitch (2, NULL);
160                                            clientWarpMouse (clientGetFocus ());
161                                            break;
162                                    case KEY_WORKSPACE_4:
163                                            workspaceSwitch (3, NULL);
164                                            clientWarpMouse (clientGetFocus ());
165                                            break;
166                                    case KEY_WORKSPACE_5:
167                                            workspaceSwitch (4, NULL);
168                                            clientWarpMouse (clientGetFocus ());
169                                            break;
170                                    case KEY_WORKSPACE_6:
171                                            workspaceSwitch (5, NULL);
172                                            clientWarpMouse (clientGetFocus ());
173                                            break;
174                                    case KEY_WORKSPACE_7:
175                                            workspaceSwitch (6, NULL);
176                                            clientWarpMouse (clientGetFocus ());
177                                            break;
178                                    case KEY_WORKSPACE_8:
179                                            workspaceSwitch (7, NULL);
180                                            clientWarpMouse (clientGetFocus ());
181                                            break;
182                                    case KEY_WORKSPACE_9:
183                                            workspaceSwitch (8, NULL);
184                                            clientWarpMouse (clientGetFocus ());
185                                            break;
186                                    case KEY_MOVE_NEXT_WORKSPACE:
187                                            workspaceSwitch (workspace + 1, c);
188                                            clientWarpMouse (clientGetFocus ());
189                                            break;
190                                    case KEY_MOVE_PREV_WORKSPACE:
191                                            workspaceSwitch (workspace - 1, c);
192                                            clientWarpMouse (clientGetFocus ());
193                                            break;
194                                    case KEY_MOVE_WORKSPACE_1:
195                                            workspaceSwitch (0, c);
196                                            clientWarpMouse (clientGetFocus ());
197                                            break;
198                                    case KEY_MOVE_WORKSPACE_2:
199                                            workspaceSwitch (1, c);
200                                            clientWarpMouse (clientGetFocus ());
201                                            break;
202                                    case KEY_MOVE_WORKSPACE_3:
203                                            workspaceSwitch (2, c);
204                                            clientWarpMouse (clientGetFocus ());
205                                            break;
206                                    case KEY_MOVE_WORKSPACE_4:
207                                            workspaceSwitch (3, c);
208                                            clientWarpMouse (clientGetFocus ());
209                                            break;
210                                    case KEY_MOVE_WORKSPACE_5:
211                                            workspaceSwitch (4, c);
212                                            clientWarpMouse (clientGetFocus ());
213                                            break;
214                                    case KEY_MOVE_WORKSPACE_6:
215                                            workspaceSwitch (5, c);
216                                            clientWarpMouse (clientGetFocus ());
217                                            break;
218                                    case KEY_MOVE_WORKSPACE_7:
219                                            workspaceSwitch (6, c);
220                                            clientWarpMouse (clientGetFocus ());
221                                            break;
222                                    case KEY_MOVE_WORKSPACE_8:
223                                            workspaceSwitch (7, c);
224                                            clientWarpMouse (clientGetFocus ());
225                                            break;
226                                    case KEY_MOVE_WORKSPACE_9:
227                                            workspaceSwitch (8, c);
228                                            clientWarpMouse (clientGetFocus ());
229                                            break;
230                                    }
231                    }
232            else
233                    {
234                            switch (key)
235                                    {
236                                    case KEY_QUIT:
237                                            quit = True;
238                                            break;
239                                    case KEY_CYCLE_WINDOWS:
240                                            if (clients)
241                                                    clientCycle (clients->prev);
242                                            break;
243                                    case KEY_NEXT_WORKSPACE:
244                                            workspaceSwitch (workspace + 1, NULL);
245                                            clientWarpMouse (clientGetFocus ());
246                                            break;
247                                    case KEY_PREV_WORKSPACE:
248                                            workspaceSwitch (workspace - 1, NULL);
249                                            clientWarpMouse (clientGetFocus ());
250                                            break;
251                                    case KEY_ADD_WORKSPACE:
252                                            workspaceSetCount (workspace_count + 1);
253                                            setNetWorkarea (margins, workspace_count);
254                                            break;
255                                    case KEY_DEL_WORKSPACE:
256                                            workspaceSetCount (workspace_count - 1);
257                                            setNetWorkarea (margins, workspace_count);
258                                            break;
259                                    case KEY_WORKSPACE_1:
260                                            workspaceSwitch (0, NULL);
261                                            clientWarpMouse (clientGetFocus ());
262                                            break;
263                                    case KEY_WORKSPACE_2:
264                                            workspaceSwitch (1, NULL);
265                                            clientWarpMouse (clientGetFocus ());
266                                            break;
267                                    case KEY_WORKSPACE_3:
268                                            workspaceSwitch (2, NULL);
269                                            clientWarpMouse (clientGetFocus ());
270                                            break;
271                                    case KEY_WORKSPACE_4:
272                                            workspaceSwitch (3, NULL);
273                                            clientWarpMouse (clientGetFocus ());
274                                            break;
275                                    case KEY_WORKSPACE_5:
276                                            workspaceSwitch (4, NULL);
277                                            clientWarpMouse (clientGetFocus ());
278                                            break;
279                                    case KEY_WORKSPACE_6:
280                                            workspaceSwitch (5, NULL);
281                                            clientWarpMouse (clientGetFocus ());
282                                            break;
283                                    case KEY_WORKSPACE_7:
284                                            workspaceSwitch (6, NULL);
285                                            clientWarpMouse (clientGetFocus ());
286                                            break;
287                                    case KEY_WORKSPACE_8:
288                                            workspaceSwitch (7, NULL);
289                                            clientWarpMouse (clientGetFocus ());
290                                            break;
291                                    case KEY_WORKSPACE_9:
292                                            workspaceSwitch (8, NULL);
293                                            clientWarpMouse (clientGetFocus ());
294                                            break;
295                                    }
296                    }
297    
298            while (XCheckTypedEvent (dpy, EnterNotify, &e));
299  }  }
300    
301  void  void
302  handleButtonPress (XButtonEvent * ev)  handleButtonPress (XButtonEvent * ev)
303  {  {
304    Client *c;          Client *c;
305    Window win;          Window win;
306    int state, replay = False;          int state, replay = False;
307    static Time last_button_time;          static Time last_button_time;
308    
309  #ifdef DEBUG  #ifdef DEBUG
310    printf ("entering handleButtonPress\n");          printf ("entering handleButtonPress\n");
311  #endif  #endif
312    
313    while (XCheckTypedEvent (dpy, ButtonPress, (XEvent *) ev));          while (XCheckTypedEvent (dpy, ButtonPress, (XEvent *) ev));
314    
315    state = ev->state & (Mod1Mask | ShiftMask | ControlMask);          state = ev->state & (Mod1Mask | ShiftMask | ControlMask);
316    
317    c = clientGetFromWindow (ev->window, FRAME);          c = clientGetFromWindow (ev->window, FRAME);
318    if (c)          if (c)
319      {                  {
320        state = ev->state & (Mod1Mask | ShiftMask | ControlMask);                          state = ev->state & (Mod1Mask | ShiftMask | ControlMask);
321        win = getMouseWindow (dpy, c->frame);                          win = getMouseWindow (dpy, c->frame);
322    
323        clientSetFocus (c, True);                          clientSetFocus (c, True);
324    
325        if (win == c->buttons[HIDE_BUTTON] ||                          if (win == c->buttons[HIDE_BUTTON] ||
326            win == c->buttons[CLOSE_BUTTON] ||                                          win == c->buttons[CLOSE_BUTTON] ||
327            win == c->buttons[MAXIMIZE_BUTTON] ||                                          win == c->buttons[MAXIMIZE_BUTTON] ||
328            win == c->buttons[SHADE_BUTTON])                                          win == c->buttons[SHADE_BUTTON])
329          {                                  {
330            clientRaise (c);                                          clientRaise (c);
331            clientButtonPress (c, win, ev);                                          clientButtonPress (c, win, ev);
332          }                                  }
333        else if (((win == c->title || win == c->sides[SIDE_BOTTOM] ||                          else if (((win == c->title || win == c->sides[SIDE_BOTTOM] ||
334                   win == c->sides[SIDE_LEFT] || win == c->sides[SIDE_RIGHT]) &&                                                                   win == c->sides[SIDE_LEFT] || win == c->sides[SIDE_RIGHT]) &&
335                  ev->button == Button1 && state == 0) || (ev->button == Button1                                                                  ev->button == Button1 && state == 0) || (ev->button == Button1
336                                                           && state ==                                                                                                                                                                                                                                   && state ==
337                                                           keys[KEY_WINDOW_OPS].                                                                                                                                                                                                                                   keys[KEY_WINDOW_OPS].
338                                                           modifier))                                                                                                                                                                                                                                   modifier))
339          {                                  {
340            clientRaise (c);                                          clientRaise (c);
341            if (ev->time - last_button_time <= 250 && last_button_time != 0)                                          if (ev->time - last_button_time <= 250 && last_button_time != 0)
342              {                                                  {
343                switch (double_click_action)                                                          switch (double_click_action)
344                  {                                                                  {
345                  case ACTION_MAXIMIZE:                                                                  case ACTION_MAXIMIZE:
346                    clientToggleMaximized (c, WIN_STATE_MAXIMIZED);                                                                          clientToggleMaximized (c, WIN_STATE_MAXIMIZED);
347                    break;                                                                          break;
348                  case ACTION_SHADE:                                                                  case ACTION_SHADE:
349                    clientToggleShaded (c);                                                                          clientToggleShaded (c);
350                    break;                                                                          break;
351                  case ACTION_HIDE:                                                                  case ACTION_HIDE:
352                    clientHide (c, True);                                                                          clientHide (c, True);
353                    break;                                                                          break;
354                  }                                                                  }
355                last_button_time = 0;                                                          last_button_time = 0;
356              }                                                  }
357            else                                          else
358              {                                                  {
359                clientMove (c, (XEvent *) ev);                                                          clientMove (c, (XEvent *) ev);
360                last_button_time = ev->time;                                                          last_button_time = ev->time;
361              }                                                  }
362          }                                  }
363        else if ((win == c->corners[CORNER_TOP_LEFT] ||                          else if ((win == c->corners[CORNER_TOP_LEFT] ||
364                  win == c->corners[CORNER_TOP_RIGHT] ||                                                                  win == c->corners[CORNER_TOP_RIGHT] ||
365                  win == c->corners[CORNER_BOTTOM_LEFT] ||                                                                  win == c->corners[CORNER_BOTTOM_LEFT] ||
366                  win == c->corners[CORNER_BOTTOM_RIGHT]) &&                                                                  win == c->corners[CORNER_BOTTOM_RIGHT]) &&
367                 ev->button == Button1 && state == 0)                                                           ev->button == Button1 && state == 0)
368          {                                  {
369            clientRaise (c);                                          clientRaise (c);
370            clientResize (c, (XEvent *) ev);                                          clientResize (c, (XEvent *) ev);
371          }                                  }
372        else if (win != c->window && ev->button == Button2 && state == 0)                          else if (win != c->window && ev->button == Button2 && state == 0)
373          {                                  {
374            clientRaise (c);                                          clientRaise (c);
375            clientToggleSticky (c);                                          clientToggleSticky (c);
376          }                                  }
377        else if (ev->button == Button2                          else if (ev->button == Button2
378                 && state == keys[KEY_WINDOW_OPS].modifier)                                                           && state == keys[KEY_WINDOW_OPS].modifier)
379          {                                  {
380            clientRaise (c);                                          clientRaise (c);
381            clientResize (c, (XEvent *) ev);                                          clientResize (c, (XEvent *) ev);
382          }                                  }
383        else if ((win != c->window && ev->button == Button3 && state == 0) ||                          else if ((win != c->window && ev->button == Button3 && state == 0) ||
384                 (ev->button == Button3                                                           (ev->button == Button3
385                  && state == keys[KEY_WINDOW_OPS].modifier))                                                                  && state == keys[KEY_WINDOW_OPS].modifier))
386          clientLower (c);                                  clientLower (c);
387        else if (win != c->window && ev->button == Button1 && state == Mod1Mask)                          else if (win != c->window && ev->button == Button1 && state == Mod1Mask)
388          clientSetLayer (c, c->win_layer + 1);                                  clientSetLayer (c, c->win_layer + 1);
389        else if (win != c->window && ev->button == Button3 && state == Mod1Mask)                          else if (win != c->window && ev->button == Button3 && state == Mod1Mask)
390          clientSetLayer (c, c->win_layer - 1);                                  clientSetLayer (c, c->win_layer - 1);
391        else                          else
392          {                                  {
393            if (raise_on_click)                                          if (raise_on_click)
394              clientRaise (c);                                                  clientRaise (c);
395            if (win == c->window)                                          if (win == c->window)
396              replay = True;                                                  replay = True;
397          }                                  }
398    
399        if (replay)                          if (replay)
400          XAllowEvents (dpy, ReplayPointer, CurrentTime);                                  XAllowEvents (dpy, ReplayPointer, CurrentTime);
401        else                          else
402          XAllowEvents (dpy, SyncPointer, CurrentTime);                                  XAllowEvents (dpy, SyncPointer, CurrentTime);
403    
404        raise_counter = -1;                          raise_counter = -1;
405      }                  }
406    else          else
407      {                  {
408        XUngrabPointer (dpy, CurrentTime);                          XUngrabPointer (dpy, CurrentTime);
409        XSendEvent (dpy, gnome_win, False, SubstructureNotifyMask,                          XSendEvent (dpy, gnome_win, False, SubstructureNotifyMask,
410                    (XEvent *) ev);                                                                          (XEvent *) ev);
411      }                  }
412  }  }
413    
414  void  void
415  handleButtonRelease (XButtonEvent * ev)  handleButtonRelease (XButtonEvent * ev)
416  {  {
417  #ifdef DEBUG  #ifdef DEBUG
418    printf ("entering handleButtonRelease\n");          printf ("entering handleButtonRelease\n");
419  #endif  #endif
420    
421    XSendEvent (dpy, gnome_win, False, SubstructureNotifyMask, (XEvent *) ev);          XSendEvent (dpy, gnome_win, False, SubstructureNotifyMask, (XEvent *) ev);
422  }  }
423    
424  void  void
425  handleDestroyNotify (XDestroyWindowEvent * ev)  handleDestroyNotify (XDestroyWindowEvent * ev)
426  {  {
427    Client *c;          Client *c;
428    
429  #ifdef DEBUG  #ifdef DEBUG
430    printf ("entering handleDestroyNotify\n");          printf ("entering handleDestroyNotify\n");
431  #endif  #endif
432    
433    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
434    if (c)          if (c)
435      {                  {
436        clientUnframe (c, False);                          clientUnframe (c, False);
437        if (clients)                          if (clients)
438          clientSetFocus (clientGetNext (clients->prev, 0), True);                                  clientSetFocus (clientGetNext (clients->prev, 0), True);
439        else                          else
440          clientSetFocus (NULL, True);                                  clientSetFocus (NULL, True);
441      }                  }
442  }  }
443    
444  void  void
445  handleUnmapNotify (XUnmapEvent * ev)  handleUnmapNotify (XUnmapEvent * ev)
446  {  {
447    Client *c;          Client *c;
448    
449  #ifdef DEBUG  #ifdef DEBUG
450    printf ("entering handleUnmapNotify\n");          printf ("entering handleUnmapNotify\n");
451  #endif  #endif
452    
453    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
454    if (c)          if (c)
455      {                  {
456        if (c->ignore_unmap)                          if (c->ignore_unmap)
457          c->ignore_unmap--;                                  c->ignore_unmap--;
458        else                          else
459          {                                  {
460            clientUnframe (c, False);                                          clientUnframe (c, False);
461            if (clients)                                          if (clients)
462              clientSetFocus (clientGetNext (clients->prev, 0), True);                                                  clientSetFocus (clientGetNext (clients->prev, 0), True);
463            else                                          else
464              clientSetFocus (NULL, True);                                                  clientSetFocus (NULL, True);
465          }                                  }
466      }                  }
467  }  }
468    
469  void  void
470  handleMapRequest (XMapRequestEvent * ev)  handleMapRequest (XMapRequestEvent * ev)
471  {  {
472    Client *c;          Client *c;
473    
474  #ifdef DEBUG  #ifdef DEBUG
475    printf ("entering handleMapRequest\n");          printf ("entering handleMapRequest\n");
476  #endif  #endif
477    
478    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
479    if (c)          if (c)
480      clientShow (c, True);                  clientShow (c, True);
481    else          else
482      clientFrame (ev->window);                  clientFrame (ev->window);
483  }  }
484    
485  void  void
486  handleConfigureRequest (XConfigureRequestEvent * ev)  handleConfigureRequest (XConfigureRequestEvent * ev)
487  {  {
488    Client *c;          Client *c;
489    XWindowChanges wc;          XWindowChanges wc;
490    
491  #ifdef DEBUG  #ifdef DEBUG
492    printf ("entering handleConfigureRequest\n");          printf ("entering handleConfigureRequest\n");
493  #endif  #endif
494    
495    wc.x = ev->x;          wc.x = ev->x;
496    wc.y = ev->y;          wc.y = ev->y;
497    wc.width = ev->width;          wc.width = ev->width;
498    wc.height = ev->height;          wc.height = ev->height;
499    wc.sibling = ev->above;          wc.sibling = ev->above;
500    wc.stack_mode = ev->detail;          wc.stack_mode = ev->detail;
501    wc.border_width = ev->border_width;          wc.border_width = ev->border_width;
502    
503    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
504    if (c)          if (c)
505      clientConfigure (c, &wc, ev->value_mask);                  clientConfigure (c, &wc, ev->value_mask);
506    else          else
507      XConfigureWindow (dpy, ev->window, ev->value_mask, &wc);                  XConfigureWindow (dpy, ev->window, ev->value_mask, &wc);
508  }  }
509    
510  void  void
511  handleEnterNotify (XCrossingEvent * ev)  handleEnterNotify (XCrossingEvent * ev)
512  {  {
513    Client *c;          Client *c;
514    
515  #ifdef DEBUG  #ifdef DEBUG
516    printf ("entering handleEnterNotify\n");          printf ("entering handleEnterNotify\n");
517  #endif  #endif
518    
519    while (XCheckTypedEvent (dpy, EnterNotify, (XEvent *) ev));          while (XCheckTypedEvent (dpy, EnterNotify, (XEvent *) ev));
520    
521    c = clientGetFromWindow (ev->window, FRAME);          c = clientGetFromWindow (ev->window, FRAME);
522    if (c && !click_to_focus)          if (c && !click_to_focus)
523      clientSetFocus (c, True);                  clientSetFocus (c, True);
524  }  }
525    
526  void  void
527  handleFocusIn (XFocusChangeEvent * ev)  handleFocusIn (XFocusChangeEvent * ev)
528  {  {
529    Client *c;          Client *c;
530    
531  #ifdef DEBUG  #ifdef DEBUG
532    printf ("entering handleFocusIn\n");          printf ("entering handleFocusIn\n");
533  #endif  #endif
534    
535    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
536    if (c)          if (c)
537      {                  {
538        frameDraw (c);                          frameDraw (c);
539        if (raise_on_focus)                          if (raise_on_focus)
540          raise_counter = raise_delay;                                  raise_counter = raise_delay;
541      }                  }
542    else if (clients)          else if (clients)
543      clientSetFocus (clientGetNext (clients->prev, 0), True);                  clientSetFocus (clientGetNext (clients->prev, 0), True);
544    else          else
545      clientSetFocus (NULL, True);                  clientSetFocus (NULL, True);
546  }  }
547    
548  void  void
549  handleFocusOut (XFocusChangeEvent * ev)  handleFocusOut (XFocusChangeEvent * ev)
550  {  {
551    Client *c;          Client *c;
552    
553  #ifdef DEBUG  #ifdef DEBUG
554    printf ("entering handleFocusOut\n");          printf ("entering handleFocusOut\n");
555  #endif  #endif
556    
557    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
558    if (c)          if (c)
559      frameDraw (c);                  frameDraw (c);
560  }  }
561    
562  void  void
563  handlePropertyNotify (XPropertyEvent * ev)  handlePropertyNotify (XPropertyEvent * ev)
564  {  {
565    Client *c;          Client *c;
566    long dummy;          long dummy;
567    
568  #ifdef DEBUG  #ifdef DEBUG
569    printf ("entering handlePropertyNotify\n");          printf ("entering handlePropertyNotify\n");
570  #endif  #endif
571    
572    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
573    if (c)          if (c)
574      {                  {
575        if (ev->atom == XA_WM_NORMAL_HINTS)                          if (ev->atom == XA_WM_NORMAL_HINTS)
576          XGetWMNormalHints (dpy, c->window, c->size, &dummy);                                  XGetWMNormalHints (dpy, c->window, c->size, &dummy);
577        else if (ev->atom == XA_WM_NAME)                          else if (ev->atom == XA_WM_NAME)
578          {                                  {
579            if (c->name)                                          if (c->name)
580              free (c->name);                                                  free (c->name);
581            getWindowName (dpy, c->window, &c->name);                                          getWindowName (dpy, c->window, &c->name);
582            frameDraw (c);                                          frameDraw (c);
583          }                                  }
584        else if (ev->atom == win_hints)                          else if (ev->atom == win_hints)
585          getGnomeHint (c->window, win_hints, &c->win_hints);                                  getGnomeHint (c->window, win_hints, &c->win_hints);
586        else if (ev->atom == win_layer)                          else if (ev->atom == win_layer)
587          {                                  {
588            getGnomeHint (c->window, win_layer, &dummy);                                          getGnomeHint (c->window, win_layer, &dummy);
589            clientSetLayer (c, dummy);                                          clientSetLayer (c, dummy);
590          }                                  }
591        else if (ev->atom == win_workspace)                          else if (ev->atom == win_workspace)
592          {                                  {
593            getGnomeHint (c->window, win_workspace, &dummy);                                          getGnomeHint (c->window, win_workspace, &dummy);
594            clientSetWorkspace (c, dummy);                                          clientSetWorkspace (c, dummy);
595          }                                  }
596      }                  }
597    else          else
598      {                  {
599        if (ev->atom == win_workspace_count)                          if (ev->atom == win_workspace_count)
600          {                                  {
601            getGnomeHint (root, win_workspace_count, &dummy);                                          getGnomeHint (root, win_workspace_count, &dummy);
602            workspaceSetCount (dummy);                                          workspaceSetCount (dummy);
603            setNetWorkarea (margins, workspace_count);                                          setNetWorkarea (margins, workspace_count);
604          }                                  }
605        else if (ev->atom == gnome_panel_desktop_area)                          else if (ev->atom == gnome_panel_desktop_area)
606          {                                  {
607            getGnomeDesktopMargins (margins);                                          getGnomeDesktopMargins (margins);
608            setNetWorkarea (margins, workspace_count);                                          setNetWorkarea (margins, workspace_count);
609          }                                  }
610      }                  }
611  }  }
612    
613  void  void
614  handleClientMessage (XClientMessageEvent * ev)  handleClientMessage (XClientMessageEvent * ev)
615  {  {
616    Client *c;          Client *c;
617    
618  #ifdef DEBUG  #ifdef DEBUG
619    printf ("entering handleClientMessage\n");          printf ("entering handleClientMessage\n");
620  #endif  #endif
621    
622    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
623    if (c)          if (c)
624      {                  {
625        if (ev->message_type == wm_change_state && ev->format == 32 &&                          if (ev->message_type == wm_change_state && ev->format == 32 &&
626            ev->data.l[0] == IconicState)                                          ev->data.l[0] == IconicState)
627          clientHide (c, True);                                  clientHide (c, True);
628        else if (ev->message_type == win_layer && ev->format == 32)                          else if (ev->message_type == win_layer && ev->format == 32)
629          {                                  {
630            setGnomeHint (c->window, ev->data.l[0], win_hints);                                          setGnomeHint (c->window, ev->data.l[0], win_hints);
631            clientRaise (c);                                          clientRaise (c);
632          }                                  }
633        else if (ev->message_type == win_state && ev->format == 32)                          else if (ev->message_type == win_state && ev->format == 32)
634          clientSetState (c, ev->data.l[0], ev->data.l[1]);                                  clientSetState (c, ev->data.l[0], ev->data.l[1]);
635        else if (ev->message_type == win_layer && ev->format == 32)                          else if (ev->message_type == win_layer && ev->format == 32)
636          clientSetLayer (c, ev->data.l[0]);                                  clientSetLayer (c, ev->data.l[0]);
637        else                          else
638          if ((ev->message_type == win_workspace                                  if ((ev->message_type == win_workspace
639               || ev->message_type == net_atoms[NET_WM_DESKTOP])                                                   || ev->message_type == net_atoms[NET_WM_DESKTOP])
640              && ev->format == 32)                                                  && ev->format == 32)
641          clientSetWorkspace (c, ev->data.l[0]);                                  clientSetWorkspace (c, ev->data.l[0]);
642        else if (ev->message_type == net_atoms[NET_ACTIVE_WINDOW]                          else if (ev->message_type == net_atoms[NET_ACTIVE_WINDOW]
643                 && ev->format == 32)                                                           && ev->format == 32)
644          {                                  {
645            if (getWMState (c->window) == IconicState)                                          if (getWMState (c->window) == IconicState)
646              clientShow (c, False);                                                  clientShow (c, False);
647            clientSetFocus (c, True);                                          clientSetFocus (c, True);
648            clientRaise (c);                                          clientRaise (c);
649            setWMState (c->window, NormalState);                                          setWMState (c->window, NormalState);
650          }                                  }
651        else if (ev->message_type == net_atoms[NET_CLOSE_WINDOW]                          else if (ev->message_type == net_atoms[NET_CLOSE_WINDOW]
652                 && ev->format == 32)                                                           && ev->format == 32)
653          clientClose (c);                                  clientClose (c);
654        else if (ev->message_type == net_atoms[NET_WM_STATE]                          else if (ev->message_type == net_atoms[NET_WM_STATE]
655                 && ev->format == 32)                                                           && ev->format == 32)
656          {                                  {
657            switch (ev->data.l[0])                                          switch (ev->data.l[0])
658              {                                                  {
659              case NET_WM_STATE_ADD:                                                  case NET_WM_STATE_ADD:
660              case NET_WM_STATE_REMOVE:                                                  case NET_WM_STATE_REMOVE:
661              case NET_WM_STATE_TOGGLE:                                                  case NET_WM_STATE_TOGGLE:
662                if ((ev->data.l[1] == net_atoms[NET_WM_STATE_MAXIMIZED_HORZ]                                                          if ((ev->data.l[1] == net_atoms[NET_WM_STATE_MAXIMIZED_HORZ]
663                     || ev->data.l[1] == net_atoms[NET_WM_STATE_MAXIMIZED_VERT])                                                                           || ev->data.l[1] == net_atoms[NET_WM_STATE_MAXIMIZED_VERT])
664                    && (ev->data.l[2] == net_atoms[NET_WM_STATE_MAXIMIZED_HORZ]                                                                          && (ev->data.l[2] == net_atoms[NET_WM_STATE_MAXIMIZED_HORZ]
665                        || ev->data.l[2] ==                                                                                          || ev->data.l[2] ==
666                        net_atoms[NET_WM_STATE_MAXIMIZED_VERT]))                                                                                          net_atoms[NET_WM_STATE_MAXIMIZED_VERT]))
667                  clientToggleMaximized (c, WIN_STATE_MAXIMIZED);                                                                  clientToggleMaximized (c, WIN_STATE_MAXIMIZED);
668                break;                                                          break;
669              }                                                  }
670          }                                  }
671      }                  }
672    else          else
673      {                  {
674        if ((ev->message_type == win_workspace                          if ((ev->message_type == win_workspace
675             || ev->message_type == net_atoms[NET_WM_DESKTOP]                                           || ev->message_type == net_atoms[NET_WM_DESKTOP]
676             || ev->message_type == net_atoms[NET_CURRENT_DESKTOP])                                           || ev->message_type == net_atoms[NET_CURRENT_DESKTOP])
677            && ev->format == 32)                                          && ev->format == 32)
678          workspaceSwitch (ev->data.l[0], NULL);                                  workspaceSwitch (ev->data.l[0], NULL);
679        else                          else
680          if ((ev->message_type == win_workspace_count                                  if ((ev->message_type == win_workspace_count
681               || ev->message_type == net_atoms[NET_NUMBER_OF_DESKTOPS])                                                   || ev->message_type == net_atoms[NET_NUMBER_OF_DESKTOPS])
682              && ev->format == 32)                                                  && ev->format == 32)
683          {                                  {
684            workspaceSetCount (ev->data.l[0]);                                          workspaceSetCount (ev->data.l[0]);
685            setNetWorkarea (margins, workspace_count);                                          setNetWorkarea (margins, workspace_count);
686          }                                  }
687      }                  }
688  }  }
689    
690  void  void
691  handleShape (XShapeEvent * ev)  handleShape (XShapeEvent * ev)
692  {  {
693    Client *c;          Client *c;
694    
695  #ifdef DEBUG  #ifdef DEBUG
696    printf ("entering handleShape\n");          printf ("entering handleShape\n");
697  #endif  #endif
698    
699    c = clientGetFromWindow (ev->window, WINDOW);          c = clientGetFromWindow (ev->window, WINDOW);
700    if (c)          if (c)
701      frameDraw (c);                  frameDraw (c);
702  }  }
703    
704  void  void
705  handleEvent (XEvent * ev)  handleEvent (XEvent * ev)
706  {  {
707  #ifdef DEBUG  #ifdef DEBUG
708    printf ("entering handleEvent\n");          printf ("entering handleEvent\n");
709  #endif  #endif
710    
711    switch (ev->type)          switch (ev->type)
712      {                  {
713      case KeyPress:                  case KeyPress:
714  #ifdef DEBUG  #ifdef DEBUG
715        printf ("KeyPress\n");                          printf ("KeyPress\n");
716  #endif  #endif
717        handleKeyPress ((XKeyEvent *) ev);                          handleKeyPress ((XKeyEvent *) ev);
718        break;                          break;
719      case ButtonPress:                  case ButtonPress:
720  #ifdef DEBUG  #ifdef DEBUG
721        printf ("ButtonPress\n");                          printf ("ButtonPress\n");
722  #endif  #endif
723        handleButtonPress ((XButtonEvent *) ev);                          handleButtonPress ((XButtonEvent *) ev);
724        break;                          break;
725      case ButtonRelease:                  case ButtonRelease:
726  #ifdef DEBUG  #ifdef DEBUG
727        printf ("ButtonRelease\n");                          printf ("ButtonRelease\n");
728  #endif  #endif
729        handleButtonRelease ((XButtonEvent *) ev);                          handleButtonRelease ((XButtonEvent *) ev);
730        break;                          break;
731      case DestroyNotify:                  case DestroyNotify:
732  #ifdef DEBUG  #ifdef DEBUG
733        printf ("DestroyNotify\n");                          printf ("DestroyNotify\n");
734  #endif  #endif
735        handleDestroyNotify ((XDestroyWindowEvent *) ev);                          handleDestroyNotify ((XDestroyWindowEvent *) ev);
736        break;                          break;
737      case UnmapNotify:                  case UnmapNotify:
738  #ifdef DEBUG  #ifdef DEBUG
739        printf ("UnmapNotify\n");                          printf ("UnmapNotify\n");
740  #endif  #endif
741        handleUnmapNotify ((XUnmapEvent *) ev);                          handleUnmapNotify ((XUnmapEvent *) ev);
742        break;                          break;
743      case MapRequest:                  case MapRequest:
744  #ifdef DEBUG  #ifdef DEBUG
745        printf ("MapRequest\n");                          printf ("MapRequest\n");
746  #endif  #endif
747        handleMapRequest ((XMapRequestEvent *) ev);                          handleMapRequest ((XMapRequestEvent *) ev);
748        break;                          break;
749      case ConfigureRequest:                  case ConfigureRequest:
750  #ifdef DEBUG  #ifdef DEBUG
751        printf ("ConfigureRequest\n");                          printf ("ConfigureRequest\n");
752  #endif  #endif
753        handleConfigureRequest ((XConfigureRequestEvent *) ev);                          handleConfigureRequest ((XConfigureRequestEvent *) ev);
754        break;                          break;
755      case EnterNotify:                  case EnterNotify:
756  #ifdef DEBUG  #ifdef DEBUG
757        printf ("EnterNotify\n");                          printf ("EnterNotify\n");
758  #endif  #endif
759        handleEnterNotify ((XCrossingEvent *) ev);                          handleEnterNotify ((XCrossingEvent *) ev);
760        break;                          break;
761      case FocusIn:                  case FocusIn:
762  #ifdef DEBUG  #ifdef DEBUG
763        printf ("FocusIn\n");                          printf ("FocusIn\n");
764  #endif  #endif
765        handleFocusIn ((XFocusChangeEvent *) ev);                          handleFocusIn ((XFocusChangeEvent *) ev);
766        break;                          break;
767      case FocusOut:                  case FocusOut:
768  #ifdef DEBUG  #ifdef DEBUG
769        printf ("FocusOut\n");                          printf ("FocusOut\n");
770  #endif  #endif
771        handleFocusOut ((XFocusChangeEvent *) ev);                          handleFocusOut ((XFocusChangeEvent *) ev);
772        break;                          break;
773      case PropertyNotify:                  case PropertyNotify:
774  #ifdef DEBUG  #ifdef DEBUG
775        printf ("PropertyNotify\n");                          printf ("PropertyNotify\n");
776  #endif  #endif
777        handlePropertyNotify ((XPropertyEvent *) ev);                          handlePropertyNotify ((XPropertyEvent *) ev);
778        break;                          break;
779      case ClientMessage:                  case ClientMessage:
780  #ifdef DEBUG  #ifdef DEBUG
781        printf ("clientMessage\n");                          printf ("clientMessage\n");
782  #endif  #endif
783        handleClientMessage ((XClientMessageEvent *) ev);                          handleClientMessage ((XClientMessageEvent *) ev);
784        break;                          break;
785      default:                  default:
786  #ifdef DEBUG  #ifdef DEBUG
787        printf ("default\n");                          printf ("default\n");
788  #endif  #endif
789        if (shape && ev->type == shape_event)                          if (shape && ev->type == shape_event)
790          handleShape ((XShapeEvent *) ev);                                  handleShape ((XShapeEvent *) ev);
791      }                  }
792  }  }
793    
794  void  void
795  eventLoop ()  eventLoop ()
796  {  {
797    XEvent ev;          XEvent ev;
798    
799  #ifdef DEBUG  #ifdef DEBUG
800    printf ("entering eventLoop\n");          printf ("entering eventLoop\n");
801  #endif  #endif
802    
803    while (!quit)          while (!quit)
804      {                  {
805        while (XPending (dpy))                          while (XPending (dpy))
806          {                                  {
807            XNextEvent (dpy, &ev);                                          XNextEvent (dpy, &ev);
808            handleEvent (&ev);                                          handleEvent (&ev);
809          }                                  }
810        if (reload)                          if (reload)
811          {                                  {
812            cleanUp ();                                          cleanUp ();
813  #ifdef DEBUG  #ifdef DEBUG
814            printf ("executing: %s\n", progname);                                          printf ("executing: %s\n", progname);
815  #endif  #endif
816            execvp (progname, stat_argv);                                          execvp (progname, stat_argv);
817          }                                  }
818        if (raise_counter > 0)                          if (raise_counter > 0)
819          raise_counter--;                                  raise_counter--;
820        else if (raise_counter == 0)                          else if (raise_counter == 0)
821          {                                  {
822            if (clientGetFocus ())                                          if (clientGetFocus ())
823              clientRaise (clientGetFocus ());                                                  clientRaise (clientGetFocus ());
824            raise_counter = -1;                                          raise_counter = -1;
825          }                                  }
826        usleep (1000);                          usleep (1000);
827      }                  }
828    
829  #ifdef DEBUG  #ifdef DEBUG
830    printf ("leaving eventLoop\n");          printf ("leaving eventLoop\n");
831  #endif  #endif
832  }  }
833    
834  /**This must remain at the end of the file.**********  /**This must remain at the end of the file.**********
835   * vim600:set sw=2 ts=8:                            *   * vim600:set sw=2 ts=2:                            *
836   * vim600:set cindent cinoptions={1s,>2s,^-1s,n-1s: *   * vim600:set cindent cinoptions={1s,>2s,^-1s,n-1s: *
837   * vim600:set foldmethod=marker:                    *   * vim600:set foldmethod=marker:                    *
838   ****************************************************/   ****************************************************/

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26