Updating branch refs/heads/ochosi/tabwin to fe99c2fb53ab9c0532e006f7f974b369b1295003 (commit) from 380c869951d6da19eeccc41b62b7c5f9f920ec0d (commit)
commit fe99c2fb53ab9c0532e006f7f974b369b1295003 Author: Eric Koegel <eric.koe...@gmail.com> Date: Thu Nov 21 17:05:25 2013 +0300 Select window button on mouse over When the mouse goes over a window button in the tabwin, give that window button the focus and select it. This way the mouse functions the same way as the keyboard. When the user clicks on a window button, focus and raise that winodw and get rid of the tabwin. Signed-off-by: Simon Steinbeiss <simon.steinbe...@elfenbeinturm.at> src/cycle.c | 54 +++++++++++++++++++----------------------------------- src/tabwin.c | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/src/cycle.c b/src/cycle.c index d405d9b..79989ed 100644 --- a/src/cycle.c +++ b/src/cycle.c @@ -227,6 +227,7 @@ clientCycleEventFilter (XEvent * xevent, gpointer data) DisplayInfo *display_info; ClientCycleData *passdata; Client *c, *removed; + static Client *last_selected = NULL; eventFilterStatus status; KeyCode cancel, left, right, up, down; int key, modifiers; @@ -328,18 +329,8 @@ clientCycleEventFilter (XEvent * xevent, gpointer data) { cycling = FALSE; } - } - if (cycling) - { - if (c) - { - if (passdata->wireframe) - { - wireframeUpdate (c, passdata->wireframe); - } - } - else + if (!c) { cycling = FALSE; } @@ -361,11 +352,16 @@ clientCycleEventFilter (XEvent * xevent, gpointer data) break; case ButtonPress: case ButtonRelease: - status = EVENT_FILTER_CONTINUE; + status = EVENT_FILTER_STOP; + cycling = FALSE; /* window of the event, we might accept it later */ mouse_window = xevent->xbutton.window; break; - + case MotionNotify: + status = EVENT_FILTER_CONTINUE; + /* window of the event, we might accept it later */ + mouse_window = xevent->xcrossing.window; + break; default: status = EVENT_FILTER_CONTINUE; break; @@ -373,38 +369,26 @@ clientCycleEventFilter (XEvent * xevent, gpointer data) if (mouse_window != 0) { - Client *c2 = NULL; - /* only accept events for the tab windows */ for (li = passdata->tabwin->tabwin_list; li != NULL; li = li->next) { if (GDK_WINDOW_XID (gtk_widget_get_window (li->data)) == mouse_window) { - c2 = tabwinSelectWidget (passdata->tabwin, li->data); - if (c2) - { - c = c2; - } - - if (c) - { - if (passdata->wireframe) - { - wireframeUpdate (c, passdata->wireframe); - } - } - else - { - cycling = FALSE; - } + c = tabwinSelectWidget (passdata->tabwin, li->data); break; } } + } - if (c2 == NULL) + if (cycling) + { + if (c) { - status = EVENT_FILTER_STOP; - cycling = FALSE; + if (passdata->wireframe && last_selected != c) + { + last_selected = c; + wireframeUpdate (c, passdata->wireframe); + } } } diff --git a/src/tabwin.c b/src/tabwin.c index 747ec2f..0758d36 100644 --- a/src/tabwin.c +++ b/src/tabwin.c @@ -309,6 +309,22 @@ getMinMonitorWidth (ScreenInfo *screen_info) return min_width; } +static gboolean +cb_window_button_enter (GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + Tabwin *t = user_data; + + TRACE ("entering"); + + g_return_val_if_fail (t != NULL, FALSE); + + /* On mouse over we grab the focus for the window button and select it */ + gtk_widget_grab_focus (widget); + tabwinSelectWidget (t, widget); + + return FALSE; +} + static GtkWidget * createWindowlist (ScreenInfo *screen_info, TabwinWidget *tbw) { @@ -343,6 +359,9 @@ createWindowlist (ScreenInfo *screen_info, TabwinWidget *tbw) gtk_button_set_relief (GTK_BUTTON (window_button), GTK_RELIEF_NONE); gtk_widget_set_size_request (GTK_WIDGET (window_button), icon_size+24, icon_size+24); g_object_set_data (G_OBJECT (window_button), "client-ptr-val", c); + g_signal_connect (window_button, "enter-notify-event", G_CALLBACK (cb_window_button_enter), t); + gtk_widget_add_events (window_button, GDK_ENTER_NOTIFY_MASK); + buttonbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window_button), buttonbox); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits