Esempio n. 1
0
/**
 * Change current cursor to a animated watch (if animation supported
 * by environment).
 *
 * \param force_update		Call a gtk iteration to ensure cursor
 *				is updated.  May cause trouble if
 *				called from some signal handlers.
 */
void gsb_status_wait ( gboolean force_update )
{
    GdkWindow *current_window;
    GdkWindow *run_window;

    run_window = gtk_widget_get_window ( GTK_WIDGET ( run.window ) );

    gdk_window_set_cursor ( run_window,
                        gdk_cursor_new_for_display ( gdk_display_get_default ( ),
                        GDK_WATCH ) );

    current_window = gdk_display_get_window_at_pointer ( gdk_display_get_default ( ), NULL, NULL );

    if ( current_window && GDK_IS_WINDOW ( current_window )
     &&
     current_window != run_window )
    {
	GdkWindow * parent = gdk_window_get_toplevel ( current_window );

	if ( parent && parent != current_window )
	{
	    current_window = parent;
	}

	gdk_window_set_cursor ( current_window,
				gdk_cursor_new_for_display ( gdk_display_get_default ( ),
							     GDK_WATCH ) );

	tracked_window = current_window;
    }

    if ( force_update )
	update_gui ( );
}
Esempio n. 2
0
static VALUE
rg_window_at_pointer(VALUE self)
{
    GdkWindow *window;
    int x,y;

    window = gdk_display_get_window_at_pointer(_SELF(self), &x, &y);

    return rb_ary_new3(3, GOBJ2RVAL(window), INT2NUM(x), INT2NUM(y));
}
/* Finds the toplevel window under the mouse pointer, if any.
 */
static GtkWidget *
find_toplevel_at_pointer (GdkDisplay *display)
{
  GdkWindow *pointer_window;
  GtkWidget *widget = NULL;

  pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);

  /* The user data field of a GdkWindow is used to store a pointer
   * to the widget that created it.
   */
  if (pointer_window)
    gdk_window_get_user_data (pointer_window, (gpointer*) &widget);

  return widget ? gtk_widget_get_toplevel (widget) : NULL;
}
Esempio n. 4
0
static void tooltip_trigger(void)
{
	GdkDisplay *display = gdk_display_get_default();
	GdkWindow *window = gdk_display_get_window_at_pointer(display, NULL, NULL);
	GeanyDocument *doc = document_get_current();

	if (doc && window)
	{
		GtkWidget *event_widget;

		gdk_window_get_user_data(window, (void **) &event_widget);
		/* if you know a better working way, do not hesistate to tell me */
		if (event_widget &&
			gtk_widget_is_ancestor(event_widget, GTK_WIDGET(doc->editor->sci)))
		{
			gtk_tooltip_trigger_tooltip_query(display);
		}
	}
}
Esempio n. 5
0
File: ml_gdk.c Progetto: CRogers/obc
CAMLprim value ml_gdk_display_get_window_at_pointer (value display)
{
  gint x;
  gint y;
  GdkWindow *gwin;

  if ((gwin = gdk_display_get_window_at_pointer
       (GdkDisplay_val (display), &x, &y)))
  { /* return Some */
    CAMLparam0 ();
    CAMLlocal1(tup);

    tup = alloc_tuple(3);
    Store_field(tup,0,Val_GdkWindow(gwin));
    Store_field(tup,1,Val_int(x));
    Store_field(tup,2,Val_int(y));
    CAMLreturn(ml_some (tup));
  }
  return Val_unit;
}
Esempio n. 6
0
/**
 * gtk_tooltip_trigger_tooltip_query:
 * @display: a #GdkDisplay
 *
 * Triggers a new tooltip query on @display, in order to update the current
 * visible tooltip, or to show/hide the current tooltip.  This function is
 * useful to call when, for example, the state of the widget changed by a
 * key press.
 *
 * Since: 2.12
 */
void
gtk_tooltip_trigger_tooltip_query (GdkDisplay *display)
{
  gint x, y;
  GdkWindow *window;
  GdkEvent event;

  /* Trigger logic as if the mouse moved */
  window = gdk_display_get_window_at_pointer (display, &x, &y);
  if (!window)
    return;

  event.type = GDK_MOTION_NOTIFY;
  event.motion.window = window;
  event.motion.x = x;
  event.motion.y = y;
  event.motion.is_hint = FALSE;

  gdk_window_get_root_coords (window, x, y, &x, &y);
  event.motion.x_root = x;
  event.motion.y_root = y;

  _gtk_tooltip_handle_event (&event);
}
Esempio n. 7
0
/**
 * gdk_window_at_pointer:
 * @win_x: (out) (allow-none): return location for origin of the window under the pointer
 * @win_y: (out) (allow-none): return location for origin of the window under the pointer
 *
 * Obtains the window underneath the mouse pointer, returning the
 * location of that window in @win_x, @win_y. Returns %NULL if the
 * window under the mouse pointer is not known to GDK (if the window
 * belongs to another application and a #GdkWindow hasn’t been created
 * for it with gdk_window_foreign_new())
 *
 * NOTE: For multihead-aware widgets or applications use
 * gdk_display_get_window_at_pointer() instead.
 *
 * Returns: (transfer none): window under the mouse pointer
 *
 * Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
 **/
GdkWindow*
gdk_window_at_pointer (gint *win_x,
		       gint *win_y)
{
  return gdk_display_get_window_at_pointer (gdk_display_get_default (), win_x, win_y);
}