Selaa lähdekoodia

Use motionnotify to focus client with mouse, check for tag frame too

Martin Duquesnoy 12 vuotta sitten
vanhempi
commit
f224f7056f
3 muutettua tiedostoa jossa 12 lisäystä ja 7 poistoa
  1. 1 1
      configure
  2. 0 1
      src/client.c
  3. 11 5
      src/event.c

+ 1 - 1
configure

@@ -32,7 +32,7 @@ done
 
 LIBS="$LIBS $USE_XINERAMA"
 
-which pkg-config >/dev/null 2>&1
+which pkg-config > /dev/null 2>&1
 
 if [ $? -eq 0 ];
 then

+ 0 - 1
src/client.c

@@ -435,7 +435,6 @@ client_geo_hints(struct geo *g, int *s)
           g->h = s[MAXH];
 }
 
-
 void
 client_moveresize(struct client *c, struct geo *g)
 {

+ 11 - 5
src/event.c

@@ -35,6 +35,7 @@ event_buttonpress(XEvent *e)
           }
 }
 
+/*
 static void
 event_enternotify(XEvent *e)
 {
@@ -50,6 +51,7 @@ event_enternotify(XEvent *e)
      if((c = client_gb_win(ev->window)))
           client_focus(c);
 }
+*/
 
 static void
 event_clientmessageevent(XEvent *e)
@@ -184,17 +186,21 @@ event_unmapnotify(XEvent *e)
           client_remove(c);
 }
 
-/*
 static void
 event_motionnotify(XEvent *e)
 {
      XMotionEvent *ev = &e->xmotion;
      struct client *c;
 
-     if((c = client_gb_win(ev->subwindow)) && c != c->tag->sel)
+     /*
+      * Check client window and tag frame to get focused
+      * window with mouse motion
+      */
+     if(((c = client_gb_win(ev->subwindow)) && c != c->tag->sel)
+        || (ev->window == W->screen->seltag->frame
+          && ((c = client_gb_pos(W->screen->seltag, ev->x, ev->y)))))
           client_focus(c);
 }
-*/
 
 static void
 event_keypress(XEvent *e)
@@ -244,14 +250,14 @@ event_init(void)
      event_handle[ClientMessage]    = event_clientmessageevent;
      event_handle[ConfigureRequest] = event_configureevent;
      event_handle[DestroyNotify]    = event_destroynotify;
-     event_handle[EnterNotify]      = event_enternotify;
+     /*event_handle[EnterNotify]      = event_enternotify;*/
      event_handle[Expose]           = event_expose;
      event_handle[FocusIn]          = event_focusin;
      event_handle[KeyPress]         = event_keypress;
      /*event_handle[MapNotify]        = event_mapnotify;*/
      event_handle[MapRequest]       = event_maprequest;
      event_handle[MappingNotify]    = event_mappingnotify;
-     /*event_handle[MotionNotify]     = event_motionnotify;*/
+     event_handle[MotionNotify]     = event_motionnotify;
      event_handle[PropertyNotify]   = event_propertynotify;
      /*event_handle[ReparentNotify]   = event_reparentnotify;*/
      /*event_handle[SelectionClear]   = event_selectionclearevent;*/