[Xfce4-commits] <xfce4-smartbookmark-plugin:master> Fix focusing the entry widget
Florian Rivoal
noreply at xfce.org
Tue Nov 1 14:52:03 CET 2011
Updating branch refs/heads/master
to 195f3ba726afeab794a305d763fa91376aabe748 (commit)
from 9fbab39fecbba4e70a665a31fd133da713ac6a2b (commit)
commit 195f3ba726afeab794a305d763fa91376aabe748
Author: Florian Rivoal <frivoal at gmail.com>
Date: Tue Nov 1 06:06:22 2011 -0700
Fix focusing the entry widget
Thanks to Guido Berhoerster for the patch. This solves Bug 7256.
src/Makefile.am | 4 +---
src/smartbookmark.c | 30 ++++--------------------------
2 files changed, 5 insertions(+), 29 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 30c058c..406421e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,8 +9,7 @@ libsmartbookmark_la_LDFLAGS = \
-module \
@LIBXFCE4PANEL_LIBS@ \
@LIBXFCEGUI4_LIBS@ \
- @GDK_LIBS@ \
- @LIBX11_LDFLAGS@
+ @GDK_LIBS@
libsmartbookmark_la_SOURCES = \
smartbookmark.c
@@ -21,7 +20,6 @@ libsmartbookmark_la_CFLAGS = \
-I$(top_srcdir) \
@LIBXFCEGUI4_CFLAGS@ \
@LIBXFCE4PANEL_CFLAGS@ \
- @LIBX11_CFLAGS@ \
@GDK_CFLAGS@ \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\"
diff --git a/src/smartbookmark.c b/src/smartbookmark.c
index dd20c8d..17db33e 100644
--- a/src/smartbookmark.c
+++ b/src/smartbookmark.c
@@ -35,9 +35,6 @@
#include <config.h>
#endif
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
@@ -133,34 +130,15 @@ static void text_entry_activate_cb(GtkWidget *widget, t_search *search)
update_search(search);
}
-static gboolean entry_buttonpress_cb(GtkWidget *entry, GdkEventButton *event, gpointer data)
+static gboolean entry_buttonpress_cb(GtkWidget *entry, GdkEventButton *event, XfcePanelPlugin *plugin)
{
- static Atom atom = 0;
GtkWidget *toplevel = gtk_widget_get_toplevel (entry);
if (event->button != 3 && toplevel && toplevel->window) {
- XClientMessageEvent xev;
-
- if (G_UNLIKELY(!atom))
- atom = XInternAtom (GDK_DISPLAY(), "_NET_ACTIVE_WINDOW", FALSE);
-
- xev.type = ClientMessage;
- xev.window = GDK_WINDOW_XID (toplevel->window);
- xev.message_type = atom;
- xev.format = 32;
- xev.data.l[0] = 0;
- xev.data.l[1] = 0;
- xev.data.l[2] = 0;
- xev.data.l[3] = 0;
- xev.data.l[4] = 0;
-
- XSendEvent (GDK_DISPLAY (), GDK_ROOT_WINDOW (), False,
- StructureNotifyMask, (XEvent *) & xev);
-
- gtk_widget_grab_focus (entry);
+ xfce_panel_plugin_focus_widget (plugin, entry);
}
- return FALSE;
+ return FALSE;
}
/* callback: called when a button is pressed into the main entry */
@@ -214,7 +192,7 @@ static t_search *search_new(XfcePanelPlugin *plugin)
gtk_box_pack_start(GTK_BOX(box), search->entry, FALSE, FALSE, 0);
// g_signal_connect(command->entry, "activate", G_CALLBACK(runcl), command);
g_signal_connect(search->entry, "key-press-event", G_CALLBACK(entry_keypress_cb), search);
- g_signal_connect (search->entry, "button-press-event", G_CALLBACK(entry_buttonpress_cb), NULL);
+ g_signal_connect (search->entry, "button-press-event", G_CALLBACK(entry_buttonpress_cb), plugin);
gtk_container_add( GTK_CONTAINER(plugin), search->ebox);
xfce_panel_plugin_add_action_widget(plugin, search->ebox);
More information about the Xfce4-commits
mailing list