Garry R. Osgood ([EMAIL PROTECTED]) wrote:
> Simon wrote:
> > When selecting something (e.g. tearing the menu off) the marching ants die.
> > When opening a new image they are alive for the new image.
> I Confirm this as well. Excellent, Simon, for you have brought forth
> the work-around to the problem for the poor Gimp user until this is
> resolved: When Marching Ants Die, Cntl-D for a New Image (I suppose
> saving the image first won't be such a bad idea).  This creates a new
> Selection object for that image without an unbalanced pause count.

Heh - I didn't realize this... :-)

[does GTK handle the XInput-devices and the "normal mouse" in the same way?]
> At present, we know that is not entirely true in two mixes of hardware.
> However, the manner in which they are untrue appears essentially the same.
> I have, however, just read Raphael's well-documented response, and he
> is seeing quite different things. I need more time to reflect on his
> mail, but his results suggest that 10498 does have hardware
> dependencies. I think a sensible fix is not immediately forthcoming.

I wrote a small program to monitor the extended XInput-Events, it is
attached. For my Artpad II it shows a strange thing: If I press the "right"
Pen-Button when pressing the Pen on the tablet, each motion event is
surrounded by proximity in and proximity out events for the
eraser side of the pen. This is probably a bug in the XFree-driver
or a bad tablet-protocol. There is a strange comment in the Driver
source (The Artpad II speaks the Wacom 4 protocol, Intuos Wacom 5:

if (common->wcmProtocolLevel == 4 &&
    !(common->wcmFlags & GRAPHIRE_FLAG)) {
    /* The stylus reports button 4 for the second side
     * switch and button 4/5 for the eraser tip. We know
     * how to choose when we come in proximity for the
     * first time. If we are in proximity and button 4 then
     * we have the eraser else we have the second side
     * switch.

Maybe there is a bug in the XFree86 driver with this assumption?

My demo program is simply compiled with
    gcc -o xinputev xinputev.c `gtk-config --libs --cflags`

When invoked with an additional argument it does report the motion
events too. When you press the right button it invokes a
submenu without any function. You can see, that under certain 
circumstances the release events for the buttons 1/3 dont reach the
main window.

/* XInputEV -- a program for monitoring XInput-Events
 * Copyright (C) 2000 Simon Budig <[EMAIL PROTECTED]>
 * Distributed under the terms of the GNU GPL.
 * compile with
 *     gcc -o xinputev xinputev.c `gtk-config --libs --cflags`

#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

                      GDK_PROXIMITY_OUT_MASK | \
                      GDK_BUTTON_PRESS_MASK | \
                      GDK_BUTTON_RELEASE_MASK | \
                      GDK_POINTER_MOTION_MASK )

GtkMenu *menu = NULL;
GtkWidget *menupoint = NULL;

/* Event-Handler */
printevent (GtkWidget *widget, GdkEvent *ev, gpointer user_data)
   GdkEventButton *bev=NULL;
   GdkEventMotion *mev=NULL;
   GdkEventProximity *pev=NULL;
   GtkWidget *win = NULL;

   switch (ev->type)
      case GDK_BUTTON_PRESS:
         bev = (GdkEventButton *) ev;
         g_printerr ("button_press  ");
         if (bev->button == 3)
            gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 3, GDK_CURRENT_TIME);
      case GDK_2BUTTON_PRESS:
         bev = (GdkEventButton *) ev;
         g_printerr ("button2_press ");
      case GDK_3BUTTON_PRESS:
         bev = (GdkEventButton *) ev;
         g_printerr ("button3_press ");
         bev = (GdkEventButton *) ev;
         g_printerr ("button_release");
      case GDK_PROXIMITY_IN:
         pev = (GdkEventProximity *) ev;
         g_printerr ("proximity_in  ");
         pev = (GdkEventProximity *) ev;
         g_printerr ("proximity_out ");
         mev = (GdkEventMotion *) ev;
         g_printerr ("motion_notify ");
         g_printerr ("Unknown Event\n");

   if (bev)
      g_printerr (":  device %5d  pressure %6.3f  button %d\n",
                  bev->deviceid, bev->pressure,
                  bev->type == GDK_BUTTON_RELEASE ? bev->button * -1 :
                                                    bev->button );
   if (pev)
      g_printerr (":  device %5d\n", pev->deviceid);
   if (mev)
      g_printerr (":  device %5d  pressure %6.3f\n",
                  mev->deviceid, mev->pressure);
   return 0;

main (int argc, char **argv)
   GList *tmp_list;
   GtkWidget *win;

   gtk_init (&argc, &argv);

   win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_usize (GTK_WIDGET (win), 200, 200);

   gtk_signal_connect (GTK_OBJECT (win), "delete-event", 
                       GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
   gtk_signal_connect (GTK_OBJECT (win), "destroy", 
                       GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

   gtk_widget_set_events (win, EVENT_MASK);
   gtk_widget_set_extension_events (win, GDK_EXTENSION_EVENTS_ALL);

   /* only show motion events when an extra argument is given */
   if (argc > 1)
      gtk_signal_connect (GTK_OBJECT (win), "motion_notify_event",
                          GTK_SIGNAL_FUNC (printevent), NULL);
   gtk_signal_connect (GTK_OBJECT (win), "button_press_event",
                       GTK_SIGNAL_FUNC (printevent), NULL);
   gtk_signal_connect (GTK_OBJECT (win), "button_release_event",
                       GTK_SIGNAL_FUNC (printevent), NULL);
   gtk_signal_connect (GTK_OBJECT (win), "proximity_in_event",
                       GTK_SIGNAL_FUNC (printevent), NULL);
   gtk_signal_connect (GTK_OBJECT (win), "proximity_out_event",
                       GTK_SIGNAL_FUNC (printevent), NULL);

   gtk_widget_show_all (win);

   menu = GTK_MENU (gtk_menu_new());
   menupoint = gtk_menu_item_new_with_label ("Hello");
   gtk_widget_show_all (menupoint);
   gtk_menu_append (menu, menupoint);

   /* Input Devices */
   tmp_list = gdk_input_list_devices ();
   while (tmp_list)
      GdkDeviceInfo *info = (GdkDeviceInfo *) tmp_list->data;
      if (strstr (info->name, "raser"))  /* Guess "Eraser"-Type devices */
         gdk_input_set_source (info->deviceid, GDK_SOURCE_ERASER);

      g_printerr ("Enabling No. %d: \"%s\" (Type: %d)\n",
                  info->deviceid, info->name, info->source);

      if (! strstr (info->name, "SWITCH"))
         /* Dont touch the "SWITCH"-Device - this seems to confuse Gtk+ */
         gdk_input_set_mode (info->deviceid, GDK_MODE_SCREEN);

      tmp_list = tmp_list->next;

   /* Start doing something */

   gtk_main ();
   gdk_pointer_ungrab (GDK_CURRENT_TIME);
   return 0;

/*    vim: sw=3 ts=8 cindent noai bs=2 cinoptions=(0       */

Reply via email to