Re: Disabling highlighting in GTK

Adam Biglow wrote:

> I'm working with GTK to develop a browser using WebKit which was
> fairly easy. WebKit is essentially just placed inside of a
> ScrolledWindow. The question I have is how I would disable
> text/object highlighting? Since the browser will run on a touch
> screen, any finger movement causes things to be highlighted.

You can create a theme that makes highlighted widget look equally as

Here is a quick hack using gtk event filtering. It blocks all activation
events. It works well, but probably blocks more that you
want - for example tap to menu bar and moving stylus over different
menus does not work, as it needs notify signals as well. It needs some
experimenting and improvement.

Maybe it should not block enter/leave signals if button is pressed
(stylus is on the screen) and generate leave signal if button is
released (stylus was lifted). Maybe use g_signal_handler_block() applied
on "enter" and "leave" signals. Maybe use gtk_get_event_widget() in the
filter and block events only for selected widget.

#include <gtk/gtk.h>

static void
filter (GdkEvent *event, gpointer data)
  if (event->type != GDK_ENTER_NOTIFY && event->type != GDK_LEAVE_NOTIFY)
    gtk_main_do_event (event);

gtk_module_init (gint *argc, gchar ***argv)
  gdk_event_handler_set (filter, NULL, NULL);

Please let me know your result. I am thinking about improvement of libgtkstylus.

Best Regards / S pozdravem,

Stanislav Brabec
software developer
SUSE LINUX, s. r. o.                          e-mail: sbrabec suse cz
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                          

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]