Re: drawing area and motion hint mask

2009-07-29 Thread Carlos Pereira

Emmanuel Touzery wrote:

Hello,

I'm trying to detect mouse moves in a drawing area. The default 
behaviour without the GDK_POINTER_MOTION_HINT_MASK is as expected 
flooding me with events which I can't handle.
Perhaps you could have something as the code below (it works for me. It 
is based in GtkGlArea / GtkGLExt examples and discussions in this list 
with Havoc Pennington years ago)


I strongly suggest you to have a look in the examples coming with GtkGlExt,

Carlos Pereira
-
g_signal_connect (area, "motion_notify_event",
G_CALLBACK (callback_area_notify), window);

int callback_area_notify (GtkWidget *widget,
GdkEventMotion *event, void *data)
{
my_structure *structure = (my_structure *) data;
GdkModifierType state;
int width = widget->allocation.width;
int height = widget->allocation.height;
int x, y;

if (event->is_hint) gdk_window_get_pointer (event->window, &x, &y, &state);
else
 {
 x = event->x;
 y = event->y;
 state = event->state;
 }

if (state & structure->mask_button1)
 {
 }

else if (state & structure->mask_button2)
 {
 }

else if (state & structure->mask_button3)
 {
 }

/* save x,y as initial values, preparing to next scan:
difference between initial and current x, y values control speed */

structure->begin_x = x;
structure->begin_y = y;

return TRUE;
}





So I added that flag, but I still get way too many events.

In my handler I put this at the top:

printf ("got mouse move (%d)!\n", event->is_hint);

And when I don't set the HINT_MASK then is_hint is 0, if I set the 
HINT_MASK then it's 1.

So it seems I'm setting the hint properly.

That I'm getting more events (not just one, because I never call 
gdk_event_request_motions() or gdk_window_get_pointer() anywhere in my 
code) it seems somehow someone else is calling 
gdk_event_request_motions() or gdk_window_get_pointer() (the examples 
on internet are not really clear on which one to call, or both, maybe 
this changed in the past?).


So I put a breakpoint on both those methods in GDB. And indeed I'm 
hitting very often this call:


#0  IA__gdk_window_get_pointer (window=0x88bdde8, x=0xbff3aef8, 
y=0xbff3aef4,

mask=0x0) at /build/buildd/gtk+2.0-2.16.1/gdk/gdkwindow.c:3315
#1  0xb7c300f0 in IA__gdk_device_get_state (device=0x849c840,
window=0x88bdde8, axes=0x0, mask=0x0)
at /build/buildd/gtk+2.0-2.16.1/gdk/x11/gdkinput-x11.c:788
#2  0xb7be5db4 in IA__gdk_event_request_motions (event=0x849c840)
at /build/buildd/gtk+2.0-2.16.1/gdk/gdkevents.c:889
#3  0xb7e657d0 in _gtk_tooltip_handle_event (event=0x887b0c0)
at /build/buildd/gtk+2.0-2.16.1/gtk/gtktooltip.c:1287
#4  0xb7d8720d in IA__gtk_main_do_event (event=0x887b0c0)
at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:1643
#5  0xb7c1434a in gdk_event_dispatch (source=0x849c358, callback=0,
user_data=0x0) at 
/build/buildd/gtk+2.0-2.16.1/gdk/x11/gdkevents-x11.c:2364

#6  0xb78a7b88 in IA__g_main_context_dispatch (context=0x849c3a0)
at /build/buildd/glib2.0-2.20.1/glib/gmain.c:1814
#7  0xb78ab0eb in g_main_context_iterate (context=0x849c3a0, block=1,
dispatch=1, self=0x8483b80)
at /build/buildd/glib2.0-2.20.1/glib/gmain.c:2448
#8  0xb78ab5ba in IA__g_main_loop_run (loop=0x8611fb0)
at /build/buildd/glib2.0-2.20.1/glib/gmain.c:2656
#9  0xb7d877d9 in IA__gtk_main ()
at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:1205

Something about tooltips. I don't have any tooltips for now in the 
application and certainly not in this drawing area...
So I don't understand how come that tooltip code is getting 
called. It prevents me from completely controlling when I'm getting 
mouse move events. That said, I'm surely getting much less events than 
before and maybe it's "expected". It does complicate my life though. 
Is there a way to avoid this? What am I doing wrong?


I can't send the complete source of that program for now, it's 
already bigger. I'm hoping that it's obvious enough that someone can 
answer it without me having to extract the problem in a test program.


Thank you!

emmanuel
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: under in ui

2009-07-29 Thread Allin Cottrell
On Wed, 29 Jul 2009, Allin Cottrell wrote:

> I'm trying to get a button on a toolbar to produce a menu.
> The GtkUIManager docs indicate this can be done but I haven't got
> the details right yet and I wonder if someone can put me on the
> right track...

I've constructed a minimal test case (appended below).  Hopefully
someone who's familiar with the GtkUIManager API will see what I'm
doing wrong. I'm trying to comply with this in the docs: "Note
that toolitem elements may contain a menu element, but only if
their associated action specifies a GtkMenuToolButton as proxy."

Allin Cottrell

minimal GTK+ program:

#include 

const gchar *ui =
""
" "
"  "
"   "
""
""
"   "
"  "
"  "
" "
"";

GtkActionEntry toolbar_items[] = {
{ "IndexButton", GTK_STOCK_INDEX, NULL, NULL, NULL, NULL },
{ "Menu", NULL, NULL, NULL, NULL, NULL },
{ "Dummy", NULL, NULL, NULL, "Nothing", NULL },
{ "Quit", GTK_STOCK_DELETE, NULL, NULL, NULL, gtk_main_quit },
{ "Close", GTK_STOCK_CLOSE, NULL, NULL, NULL, gtk_main_quit }
};

/* I expect: the first button on the toolbar will pop down a
   menu with two items.

   I get: the first button does nothing, plus an error message:

   Gtk-CRITICAL **: gtk_menu_tool_button_set_menu: assertion
   `GTK_IS_MENU_TOOL_BUTTON (button)' failed
*/

GtkWidget *make_toolbar (void)
{
GtkActionGroup *actions;
GtkAction *action;
GtkToolItem *proxy;
GtkUIManager *mgr;
GError *err = NULL;

actions = gtk_action_group_new("Actions");
gtk_action_group_add_actions(actions, toolbar_items,
 G_N_ELEMENTS(toolbar_items),
 NULL);

action = gtk_action_group_get_action(actions, "IndexButton");
proxy = gtk_menu_tool_button_new(NULL, NULL);
gtk_action_connect_proxy(action, GTK_WIDGET(proxy));

mgr = gtk_ui_manager_new();
gtk_ui_manager_insert_action_group(mgr, actions, 0);
g_object_unref(actions);

gtk_ui_manager_add_ui_from_string(mgr, ui, -1, &err);
gtk_ui_manager_ensure_update(mgr);

if (err != NULL) {
/* this is not triggered */
fprintf(stderr, "building toolbar failed: %s",
err->message);
g_error_free(err);
}

return gtk_ui_manager_get_widget(mgr, "/toolbar");
}

int main (int argc, char **argv)
{
GtkWidget *w;

gtk_init(&argc, &argv);

w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(w), 80, -1);

g_signal_connect(G_OBJECT(w), "destroy",
 gtk_main_quit, NULL);

gtk_container_add(GTK_CONTAINER(w), make_toolbar());
gtk_widget_show_all(w);

gtk_main();

return 0;
}

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


drawing area and motion hint mask

2009-07-29 Thread Emmanuel Touzery

Hello,

I'm trying to detect mouse moves in a drawing area. The default 
behaviour without the GDK_POINTER_MOTION_HINT_MASK is as expected 
flooding me with events which I can't handle.


So I added that flag, but I still get way too many events.

In my handler I put this at the top:

printf ("got mouse move (%d)!\n", event->is_hint);

And when I don't set the HINT_MASK then is_hint is 0, if I set the 
HINT_MASK then it's 1.

So it seems I'm setting the hint properly.

That I'm getting more events (not just one, because I never call 
gdk_event_request_motions() or gdk_window_get_pointer() anywhere in my 
code) it seems somehow someone else is calling 
gdk_event_request_motions() or gdk_window_get_pointer() (the examples on 
internet are not really clear on which one to call, or both, maybe this 
changed in the past?).


So I put a breakpoint on both those methods in GDB. And indeed I'm 
hitting very often this call:


#0  IA__gdk_window_get_pointer (window=0x88bdde8, x=0xbff3aef8, 
y=0xbff3aef4,

mask=0x0) at /build/buildd/gtk+2.0-2.16.1/gdk/gdkwindow.c:3315
#1  0xb7c300f0 in IA__gdk_device_get_state (device=0x849c840,
window=0x88bdde8, axes=0x0, mask=0x0)
at /build/buildd/gtk+2.0-2.16.1/gdk/x11/gdkinput-x11.c:788
#2  0xb7be5db4 in IA__gdk_event_request_motions (event=0x849c840)
at /build/buildd/gtk+2.0-2.16.1/gdk/gdkevents.c:889
#3  0xb7e657d0 in _gtk_tooltip_handle_event (event=0x887b0c0)
at /build/buildd/gtk+2.0-2.16.1/gtk/gtktooltip.c:1287
#4  0xb7d8720d in IA__gtk_main_do_event (event=0x887b0c0)
at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:1643
#5  0xb7c1434a in gdk_event_dispatch (source=0x849c358, callback=0,
user_data=0x0) at 
/build/buildd/gtk+2.0-2.16.1/gdk/x11/gdkevents-x11.c:2364

#6  0xb78a7b88 in IA__g_main_context_dispatch (context=0x849c3a0)
at /build/buildd/glib2.0-2.20.1/glib/gmain.c:1814
#7  0xb78ab0eb in g_main_context_iterate (context=0x849c3a0, block=1,
dispatch=1, self=0x8483b80)
at /build/buildd/glib2.0-2.20.1/glib/gmain.c:2448
#8  0xb78ab5ba in IA__g_main_loop_run (loop=0x8611fb0)
at /build/buildd/glib2.0-2.20.1/glib/gmain.c:2656
#9  0xb7d877d9 in IA__gtk_main ()
at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:1205

Something about tooltips. I don't have any tooltips for now in the 
application and certainly not in this drawing area...
So I don't understand how come that tooltip code is getting called. 
It prevents me from completely controlling when I'm getting mouse move 
events. That said, I'm surely getting much less events than before and 
maybe it's "expected". It does complicate my life though. Is there a way 
to avoid this? What am I doing wrong?


I can't send the complete source of that program for now, it's 
already bigger. I'm hoping that it's obvious enough that someone can 
answer it without me having to extract the problem in a test program.


Thank you!

emmanuel
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Outdated dependencies at ftp.gnome.org (was: Makeing librsvg work (bizp2.dll missing))

2009-07-29 Thread Hartmut Goebel
Hartmut Goebel schrieb:
> Tor Lillqvist schrieb:
> 
>> There is also a libbzip2 package on ftp.gnome.org:
>>
> http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libbzip2-1.0.2.zip
> 
> Thanks for this pointer! I did not recognise the 'dependencies'
> directory. It would have made my life much, much easier :-)

After having a real look at the 'dependencies' directory, I'm horrified!
I checked four packages and they are *all* outdated and contain security
bugs. Only a few examples of vulnerabilities for these versions:

- libxml2 2.6.27: CVE-2008-3529, CVSS Severity: 10.0 (HIGH)
- libbzip2 1.0.2: CVE-2008-1372, CVSS Severity: 4.3 (MEDIUM)
- openssl 0.9.7c: CVE-2006-3738, CVSS Severity: 10.0 (HIGH)
- gnutls 2.4.1:   CVE-2008-4989, CVSS Severity: 4.3 (MEDIUM)
- gnutls 2.2.5:   CVE-2008-1948, CVSS Severity: 10.0 (HIGH)

Now I' at my wits' end!

There seams to be no reliable source for third party libraries, GTK+
depends on, which is compatible with GTK+. With reliable I mean: have
(at least nearly) up-to-date versions esp. if security fixes are published.

As I wrote earlier: I'm currently writing some tool to collect all the
dependencies for Tryton (www.tryton.org), an Open Source (GPL) ERP
system. But I can not put outdated and insecure software into the
development environment of somebody else! The one bundling the Tryton
windows installer will not be able to maintain it. He has no chance of
getting security holes fixed!

What should I do?

-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne:


Goebel Consult mit Mitglied bei 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Makeing librsvg work (bizp2.dll missing)

2009-07-29 Thread Hartmut Goebel
Hi Tor,

Tor Lillqvist schrieb:

> Sure. Why is that a problem? Users (and I mean *real* end-users, not
> "sophisticated" people who have used Linux) should not even need to be
> aware that there is something called "GTK+" and that some app in
> particular uses it. [...]
>
> I might well imagine that if various non-related GTK+-using apps
> shared a GTK+ installation and theme setting, users would be very
> confused why these, in their impression, totally unrelated
> applications, are all affected by some mysterious "GTK+ theme setting"
> thingie.

Okay, this convinced me.

Nevertheless let me answer to your other arguments

> And the waste of space argument is so last century.

Wast of space is somewhat outdated, you are right. But larger packages
need to be transmitted, and I heard rumours there are areas (somewhere
outside Europe) which do not have Gigabit to the household ;-)

> Yeah, but if there is no shared installation of just GTK+ as a
> separate entity, there obviously is no need to uninstall it separately
> either;)

Except for the developers package.

-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne:


Goebel Consult mit Mitglied bei 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

under in ui

2009-07-29 Thread Allin Cottrell
I'm trying to get a button on a toolbar to produce a menu.
The GtkUIManager docs indicate this can be done but I haven't got
the details right yet and I wonder if someone can put me on the
right track.

The ui definition is like this:

const gchar *my_ui =
""
" "
"   "
" "
"  "
" "
"   "
"   "
"   "
"   "
" "
"";

I.e. the first toolitem carries a menu (to be constructed
dynamicallly) but the others are simple buttons.

And I have this array of GtkActionEntry:

GtkActionEntry my_menu_items[] = {
{ "Topics", NULL, NULL, NULL, NULL, NULL },
{ "WindowFind", GTK_STOCK_FIND,
  N_("_Find in window"), NULL, NULL, G_CALLBACK(text_find) },
{ "ZoomIn", GTK_STOCK_ZOOM_IN, N_("_Larger"), NULL, NULL,
  G_CALLBACK(text_zoom) },
{ "ZoomOut", GTK_STOCK_ZOOM_OUT, N_("_Smaller"), NULL, NULL,
  G_CALLBACK(text_zoom) }
};

The action 'TopicsButton' doesn't have an entry in this array
because, as I understand it, I have to create a special GtkAction
with a proxy connected, as in:

GtkAction *action;
GtkToolItem *proxy;

action = gtk_action_new("TopicsButton", NULL, N_("_Topics"),
GTK_STOCK_INDEX);
proxy = gtk_menu_tool_button_new(NULL, NULL);
gtk_action_connect_proxy(action, GTK_WIDGET(proxy));

I then:

1. use gtk_action_group_add_action_with_accel() to add the
TopicsButton action to a newly created GtkActionGroup.

2. append the actions from the array above using
gtk_action_group_add_actions().

3. use gtk_ui_manager_new() to get a manager, and use
gtk_ui_manager_insert_action_group() to add the whole group.

4. use gtk_ui_manager_add_ui_from_string() with 'my_ui' as
argument.

The toolbar is shown, but the button that's supposed to carry
a menu has no "down arrow" and I get this message:

Gtk-CRITICAL **: gtk_menu_tool_button_set_menu: assertion
`GTK_IS_MENU_TOOL_BUTTON (button)' failed

Allin Cottrell





___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list