forked from AuroraMiddleware/gtk
gdk: Cursors no longer have a display
Change constructors to reflect that. While doing so, also add a fallback argument to the cursor constructors, so it is now possible to create cursors with fallback.
This commit is contained in:
parent
e2996732b9
commit
9323d098a6
@ -123,7 +123,7 @@ query_for_toplevel (GdkDisplay *display,
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
|
||||
gtk_widget_show (popup);
|
||||
cursor = gdk_cursor_new_from_name (display, "crosshair");
|
||||
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
|
||||
device = gtk_get_current_event_device ();
|
||||
|
||||
if (gdk_seat_grab (gdk_device_get_seat (device),
|
||||
|
@ -43,11 +43,9 @@ add_button (GtkWidget *section,
|
||||
const gchar *css_name)
|
||||
{
|
||||
GtkWidget *image, *button;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
display = gtk_widget_get_display (section);
|
||||
cursor = gdk_cursor_new_from_name (display, css_name);
|
||||
cursor = gdk_cursor_new_from_name (css_name, NULL);
|
||||
if (cursor == NULL)
|
||||
image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
|
||||
else
|
||||
|
@ -254,11 +254,9 @@ do_hypertext (GtkWidget *do_widget)
|
||||
GtkWidget *view;
|
||||
GtkWidget *sw;
|
||||
GtkTextBuffer *buffer;
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gtk_widget_get_display (do_widget);
|
||||
hand_cursor = gdk_cursor_new_from_name (display, "pointer");
|
||||
regular_cursor = gdk_cursor_new_from_name (display, "text");
|
||||
hand_cursor = gdk_cursor_new_from_name ("pointer", NULL);
|
||||
regular_cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
|
||||
|
@ -80,7 +80,7 @@ get_busy (GSimpleAction *action,
|
||||
GtkApplication *app = gtk_window_get_application (GTK_WINDOW (window));
|
||||
|
||||
g_application_mark_busy (G_APPLICATION (app));
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (window), "wait");
|
||||
cursor = gdk_cursor_new_from_name ("wait", NULL);
|
||||
gdk_window_set_cursor (gtk_widget_get_window (window), cursor);
|
||||
g_object_unref (cursor);
|
||||
g_timeout_add (5000, get_idle, window);
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
@ -85,7 +84,6 @@
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
PROP_FALLBACK,
|
||||
PROP_HOTSPOT_X,
|
||||
PROP_HOTSPOT_Y,
|
||||
@ -105,9 +103,6 @@ gdk_cursor_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, cursor->display);
|
||||
break;
|
||||
case PROP_FALLBACK:
|
||||
g_value_set_object (value, cursor->fallback);
|
||||
break;
|
||||
@ -139,11 +134,6 @@ gdk_cursor_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
cursor->display = g_value_get_object (value);
|
||||
/* check that implementations actually provide the display when constructing */
|
||||
g_assert (cursor->display != NULL);
|
||||
break;
|
||||
case PROP_FALLBACK:
|
||||
cursor->fallback = g_value_dup_object (value);
|
||||
break;
|
||||
@ -186,13 +176,6 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
|
||||
object_class->set_property = gdk_cursor_set_property;
|
||||
object_class->finalize = gdk_cursor_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DISPLAY,
|
||||
g_param_spec_object ("display",
|
||||
P_("Display"),
|
||||
P_("Display of this cursor"),
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FALLBACK,
|
||||
g_param_spec_object ("fallback",
|
||||
@ -283,7 +266,8 @@ gdk_cursor_equal (gconstpointer a,
|
||||
|
||||
/**
|
||||
* gdk_cursor_new_from_name:
|
||||
* @display: the #GdkDisplay for which the cursor will be created
|
||||
* @fallback: (allow-none): %NULL or the #GdkCursor to fall back to when
|
||||
* this one cannot be supported
|
||||
* @name: the name of the cursor
|
||||
*
|
||||
* Creates a new cursor by looking up @name in the current cursor
|
||||
@ -334,24 +318,25 @@ gdk_cursor_equal (gconstpointer a,
|
||||
* Since: 2.8
|
||||
*/
|
||||
GdkCursor*
|
||||
gdk_cursor_new_from_name (GdkDisplay *display,
|
||||
const gchar *name)
|
||||
gdk_cursor_new_from_name (const gchar *name,
|
||||
GdkCursor *fallback)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
|
||||
return g_object_new (GDK_TYPE_CURSOR,
|
||||
"display", display,
|
||||
"name", name,
|
||||
"fallback", fallback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_new_from_pixbuf:
|
||||
* @display: the #GdkDisplay for which the cursor will be created
|
||||
* @pixbuf: the #GdkPixbuf containing the cursor image
|
||||
* @x: the horizontal offset of the “hotspot” of the cursor.
|
||||
* @y: the vertical offset of the “hotspot” of the cursor.
|
||||
* @fallback: (allow-none): %NULL or the #GdkCursor to fall back to when
|
||||
* this one cannot be supported
|
||||
*
|
||||
* Creates a new cursor from a pixbuf.
|
||||
*
|
||||
@ -377,10 +362,10 @@ gdk_cursor_new_from_name (GdkDisplay *display,
|
||||
* Since: 2.4
|
||||
*/
|
||||
GdkCursor *
|
||||
gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
GdkPixbuf *pixbuf,
|
||||
gdk_cursor_new_from_pixbuf (GdkPixbuf *pixbuf,
|
||||
gint x,
|
||||
gint y)
|
||||
gint y,
|
||||
GdkCursor *fallback)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
const char *option;
|
||||
@ -388,8 +373,8 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
gint64 value;
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
|
||||
if (x == -1 && (option = gdk_pixbuf_get_option (pixbuf, "x_hot")))
|
||||
{
|
||||
@ -415,7 +400,7 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
|
||||
cursor = gdk_cursor_new_from_texture (display, texture, x, y);
|
||||
cursor = gdk_cursor_new_from_texture (texture, x, y, fallback);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
@ -424,10 +409,11 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
|
||||
/**
|
||||
* gdk_cursor_new_from_texture:
|
||||
* @display: the #GdkDisplay for which the cursor will be created
|
||||
* @texture: the texture providing the pixel data
|
||||
* @hotspot_x: the horizontal offset of the “hotspot” of the cursor
|
||||
* @hotspot_y: the vertical offset of the “hotspot” of the cursor
|
||||
* @fallback: (allow-none): %NULL or the #GdkCursor to fall back to when
|
||||
* this one cannot be supported
|
||||
*
|
||||
* Creates a new cursor from a #GdkTexture.
|
||||
*
|
||||
@ -448,42 +434,24 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
* Since: 3.94
|
||||
*/
|
||||
GdkCursor *
|
||||
gdk_cursor_new_from_texture (GdkDisplay *display,
|
||||
GdkTexture *texture,
|
||||
gdk_cursor_new_from_texture (GdkTexture *texture,
|
||||
int hotspot_x,
|
||||
int hotspot_y)
|
||||
int hotspot_y,
|
||||
GdkCursor *fallback)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
g_return_val_if_fail (0 <= hotspot_x && hotspot_x < gdk_texture_get_width (texture), NULL);
|
||||
g_return_val_if_fail (0 <= hotspot_y && hotspot_y < gdk_texture_get_height (texture), NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
|
||||
return g_object_new (GDK_TYPE_CURSOR,
|
||||
"display", display,
|
||||
"texture", texture,
|
||||
"hotspot-x", hotspot_x,
|
||||
"hotspot-y", hotspot_y,
|
||||
"fallback", fallback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_display:
|
||||
* @cursor: a #GdkCursor.
|
||||
*
|
||||
* Returns the display on which the #GdkCursor is defined.
|
||||
*
|
||||
* Returns: (transfer none): the #GdkDisplay associated to @cursor
|
||||
*
|
||||
* Since: 2.2
|
||||
*/
|
||||
GdkDisplay *
|
||||
gdk_cursor_get_display (GdkCursor *cursor)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_CURSOR (cursor), NULL);
|
||||
|
||||
return cursor->display;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_fallback:
|
||||
* @cursor: a #GdkCursor.
|
||||
|
@ -46,20 +46,19 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_cursor_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
GdkPixbuf *pixbuf,
|
||||
GdkCursor* gdk_cursor_new_from_pixbuf (GdkPixbuf *pixbuf,
|
||||
gint x,
|
||||
gint y);
|
||||
gint y,
|
||||
GdkCursor *fallback);
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
GdkCursor* gdk_cursor_new_from_texture (GdkDisplay *display,
|
||||
GdkTexture *texture,
|
||||
GdkCursor* gdk_cursor_new_from_texture (GdkTexture *texture,
|
||||
int hotspot_x,
|
||||
int hotspot_y);
|
||||
int hotspot_y,
|
||||
GdkCursor *fallback);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor* gdk_cursor_new_from_name (GdkDisplay *display,
|
||||
const gchar *name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay* gdk_cursor_get_display (GdkCursor *cursor);
|
||||
GdkCursor* gdk_cursor_new_from_name (const gchar *name,
|
||||
GdkCursor *fallback);
|
||||
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
|
@ -762,8 +762,8 @@ gdk_drag_get_cursor (GdkDragContext *context,
|
||||
break;
|
||||
|
||||
if (drag_cursors[i].cursor == NULL)
|
||||
drag_cursors[i].cursor = gdk_cursor_new_from_name (context->display,
|
||||
drag_cursors[i].name);
|
||||
drag_cursors[i].cursor = gdk_cursor_new_from_name (drag_cursors[i].name, NULL);
|
||||
|
||||
return drag_cursors[i].cursor;
|
||||
}
|
||||
|
||||
|
@ -4248,7 +4248,6 @@ gdk_window_set_cursor_internal (GdkWindow *window,
|
||||
return;
|
||||
|
||||
g_assert (gdk_window_get_display (window) == gdk_device_get_display (device));
|
||||
g_assert (!cursor || gdk_window_get_display (window) == gdk_cursor_get_display (cursor));
|
||||
|
||||
if (window->window_type == GDK_WINDOW_ROOT ||
|
||||
window->window_type == GDK_WINDOW_FOREIGN)
|
||||
|
@ -509,7 +509,7 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
|
||||
g_object_unref (pointer->cursor);
|
||||
|
||||
if (cursor == NULL)
|
||||
pointer->cursor = gdk_cursor_new_from_name (seat->display, "default");
|
||||
pointer->cursor = gdk_cursor_new_from_name ("default", NULL);
|
||||
else
|
||||
pointer->cursor = g_object_ref (cursor);
|
||||
|
||||
|
@ -852,13 +852,11 @@ gtk_about_dialog_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkAboutDialog *about = GTK_ABOUT_DIALOG (widget);
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GdkDisplay *display;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->realize (widget);
|
||||
|
||||
display = gtk_widget_get_display (widget);
|
||||
priv->hand_cursor = gdk_cursor_new_from_name (display, "pointer");
|
||||
priv->regular_cursor = gdk_cursor_new_from_name (display, "text");
|
||||
priv->hand_cursor = gdk_cursor_new_from_name ("pointer", NULL);
|
||||
priv->regular_cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -223,7 +223,7 @@ set_cross_cursor (GtkWidget *widget,
|
||||
return;
|
||||
|
||||
if (enabled)
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (GTK_WIDGET (widget)), "crosshair");
|
||||
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
|
||||
|
||||
gdk_window_set_device_cursor (window, device, cursor);
|
||||
|
||||
|
15
gtk/gtkdnd.c
15
gtk/gtkdnd.c
@ -147,7 +147,6 @@ static void gtk_drag_get_event_actions (const GdkEvent *event,
|
||||
GdkDragAction *suggested_action,
|
||||
GdkDragAction *possible_actions);
|
||||
static GdkCursor * gtk_drag_get_cursor (GtkWidget *widget,
|
||||
GdkDisplay *display,
|
||||
GdkDragAction action,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_update_cursor (GtkDragSourceInfo *info);
|
||||
@ -465,7 +464,6 @@ ensure_drag_cursor_pixbuf (int i)
|
||||
|
||||
static GdkCursor *
|
||||
gtk_drag_get_cursor (GtkWidget *widget,
|
||||
GdkDisplay *display,
|
||||
GdkDragAction action,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
@ -484,19 +482,13 @@ gtk_drag_get_cursor (GtkWidget *widget,
|
||||
if (drag_cursors[i].action == action)
|
||||
break;
|
||||
|
||||
if (drag_cursors[i].cursor != NULL)
|
||||
{
|
||||
if (display != gdk_cursor_get_display (drag_cursors[i].cursor))
|
||||
g_clear_object (&drag_cursors[i].cursor);
|
||||
}
|
||||
|
||||
if (drag_cursors[i].cursor == NULL)
|
||||
drag_cursors[i].cursor = gdk_cursor_new_from_name (display, drag_cursors[i].name);
|
||||
drag_cursors[i].cursor = gdk_cursor_new_from_name (drag_cursors[i].name, NULL);
|
||||
|
||||
if (drag_cursors[i].cursor == NULL)
|
||||
{
|
||||
ensure_drag_cursor_pixbuf (i);
|
||||
drag_cursors[i].cursor = gdk_cursor_new_from_pixbuf (display, drag_cursors[i].pixbuf, 0, 0);
|
||||
drag_cursors[i].cursor = gdk_cursor_new_from_pixbuf (drag_cursors[i].pixbuf, 0, 0, NULL);
|
||||
}
|
||||
|
||||
return drag_cursors[i].cursor;
|
||||
@ -519,7 +511,6 @@ gtk_drag_update_cursor (GtkDragSourceInfo *info)
|
||||
return;
|
||||
|
||||
cursor = gtk_drag_get_cursor (info->widget,
|
||||
gdk_cursor_get_display (info->cursor),
|
||||
drag_cursors[i].action, info);
|
||||
|
||||
if (cursor != info->cursor)
|
||||
@ -1220,7 +1211,6 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
&suggested_action, &possible_actions);
|
||||
|
||||
cursor = gtk_drag_get_cursor (widget,
|
||||
gtk_widget_get_display (widget),
|
||||
suggested_action,
|
||||
NULL);
|
||||
|
||||
@ -1762,7 +1752,6 @@ _gtk_drag_source_handle_event (GtkWidget *widget,
|
||||
if (info->have_grab)
|
||||
{
|
||||
cursor = gtk_drag_get_cursor (widget,
|
||||
gtk_widget_get_display (widget),
|
||||
gdk_drag_context_get_selected_action (context),
|
||||
info);
|
||||
if (info->cursor != cursor)
|
||||
|
@ -2806,7 +2806,7 @@ set_text_cursor (GtkWidget *widget)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
g_clear_object (&cursor);
|
||||
}
|
||||
@ -2817,12 +2817,9 @@ update_cursors (GtkWidget *widget)
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
EntryIconInfo *icon_info = NULL;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
gint i;
|
||||
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
if ((icon_info = priv->icons[i]) != NULL)
|
||||
@ -2832,7 +2829,7 @@ update_cursors (GtkWidget *widget)
|
||||
(gtk_widget_get_sensitive (icon_info->widget) ||
|
||||
(icon_info->nonactivatable && icon_info->target_list == NULL)))
|
||||
{
|
||||
cursor = gdk_cursor_new_from_name (display, "default");
|
||||
cursor = gdk_cursor_new_from_name ("default", NULL);
|
||||
gtk_widget_set_cursor (icon_info->widget, cursor);
|
||||
g_clear_object (&cursor);
|
||||
}
|
||||
@ -4031,7 +4028,7 @@ set_invisible_cursor (GtkWidget *widget)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "none");
|
||||
cursor = gdk_cursor_new_from_name ("none", NULL);
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
g_object_unref (cursor);
|
||||
}
|
||||
|
@ -4325,7 +4325,7 @@ set_busy_cursor (GtkFileChooserWidget *impl,
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (busy)
|
||||
cursor = gdk_cursor_new_from_name (display, "progress");
|
||||
cursor = gdk_cursor_new_from_name ("progress", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
|
@ -3756,17 +3756,14 @@ gtk_label_update_cursor (GtkLabel *label)
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
if (gtk_widget_is_sensitive (widget))
|
||||
{
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (priv->select_info->active_link)
|
||||
cursor = gdk_cursor_new_from_name (display, "pointer");
|
||||
cursor = gdk_cursor_new_from_name ("pointer", NULL);
|
||||
else if (priv->select_info->selectable)
|
||||
cursor = gdk_cursor_new_from_name (display, "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
}
|
||||
@ -4960,7 +4957,7 @@ gtk_label_set_selectable_hint (GtkLabel *label)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
g_object_unref (cursor);
|
||||
}
|
||||
|
@ -309,14 +309,12 @@ static void
|
||||
set_hand_cursor (GtkWidget *widget,
|
||||
gboolean show_hand)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
cursor = NULL;
|
||||
if (show_hand)
|
||||
cursor = gdk_cursor_new_from_name (display, "pointer");
|
||||
cursor = gdk_cursor_new_from_name ("pointer", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
|
||||
|
@ -311,11 +311,9 @@ gtk_paned_motion_notify (GtkWidget *widget,
|
||||
GtkPaned *paned = GTK_PANED (widget);
|
||||
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
||||
GdkRectangle handle_area;
|
||||
GdkDisplay *display;
|
||||
gdouble x, y;
|
||||
|
||||
get_handle_area (paned, &handle_area);
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (gdk_event_get_coords ((GdkEvent *) event, &x, &y) &&
|
||||
(gdk_rectangle_contains_point (&handle_area, x, y) ||
|
||||
@ -324,9 +322,9 @@ gtk_paned_motion_notify (GtkWidget *widget,
|
||||
GdkCursor *cursor;
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
cursor = gdk_cursor_new_from_name (display, "col-resize");
|
||||
cursor = gdk_cursor_new_from_name ("col-resize", NULL);
|
||||
else
|
||||
cursor = gdk_cursor_new_from_name (display, "row-resize");
|
||||
cursor = gdk_cursor_new_from_name ("row-resize", NULL);
|
||||
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
g_object_unref (cursor);
|
||||
|
@ -324,7 +324,6 @@ set_busy_cursor (GtkPlacesView *view,
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWindow *toplevel;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
toplevel = get_toplevel (GTK_WIDGET (view));
|
||||
@ -332,15 +331,12 @@ set_busy_cursor (GtkPlacesView *view,
|
||||
if (!toplevel || !gtk_widget_get_realized (widget))
|
||||
return;
|
||||
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (busy)
|
||||
cursor = gdk_cursor_new_from_name (display, "progress");
|
||||
cursor = gdk_cursor_new_from_name ("progress", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
|
||||
gdk_display_flush (display);
|
||||
|
||||
if (cursor)
|
||||
g_object_unref (cursor);
|
||||
|
@ -581,7 +581,6 @@ set_busy_cursor (GtkPrintUnixDialog *dialog,
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWindow *toplevel;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
toplevel = get_toplevel (GTK_WIDGET (dialog));
|
||||
@ -590,15 +589,12 @@ set_busy_cursor (GtkPrintUnixDialog *dialog,
|
||||
if (!toplevel || !gtk_widget_get_realized (widget))
|
||||
return;
|
||||
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (busy)
|
||||
cursor = gdk_cursor_new_from_name (display, "progress");
|
||||
cursor = gdk_cursor_new_from_name ("progress", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
|
||||
gdk_display_flush (display);
|
||||
|
||||
if (cursor)
|
||||
g_object_unref (cursor);
|
||||
|
@ -636,7 +636,7 @@ set_busy_cursor (GtkRecentChooserDefault *impl,
|
||||
display = gtk_widget_get_display (GTK_WIDGET (toplevel));
|
||||
|
||||
if (busy)
|
||||
cursor = gdk_cursor_new_from_name (display, "progress");
|
||||
cursor = gdk_cursor_new_from_name ("progress", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
|
@ -3194,11 +3194,9 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
|
||||
static void
|
||||
install_scroll_cursor (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (scrolled_window));
|
||||
cursor = gdk_cursor_new_from_name (display, "all-scroll");
|
||||
cursor = gdk_cursor_new_from_name ("all-scroll", NULL);
|
||||
gtk_widget_set_cursor (GTK_WIDGET (scrolled_window), cursor);
|
||||
g_clear_object (&cursor);
|
||||
}
|
||||
|
@ -4710,7 +4710,7 @@ gtk_text_view_map (GtkWidget *widget)
|
||||
if (priv->bottom_window)
|
||||
text_window_map (priv->bottom_window);
|
||||
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
g_object_unref (cursor);
|
||||
|
||||
@ -4843,7 +4843,7 @@ gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
if (gtk_widget_is_sensitive (widget))
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
@ -4882,11 +4882,9 @@ gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||
static void
|
||||
set_invisible_cursor (GdkWindow *window)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
cursor = gdk_cursor_new_from_name (display, "none");
|
||||
cursor = gdk_cursor_new_from_name ("none", NULL);
|
||||
|
||||
gdk_window_set_cursor (window, cursor);
|
||||
|
||||
@ -4909,11 +4907,9 @@ gtk_text_view_unobscure_mouse_cursor (GtkTextView *text_view)
|
||||
{
|
||||
if (text_view->priv->mouse_cursor_obscured)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (text_view));
|
||||
cursor = gdk_cursor_new_from_name (display, "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
gdk_window_set_cursor (text_view->priv->text_window->bin_window, cursor);
|
||||
g_object_unref (cursor);
|
||||
text_view->priv->mouse_cursor_obscured = FALSE;
|
||||
@ -9739,7 +9735,6 @@ text_window_realize (GtkTextWindow *win,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
@ -9764,8 +9759,7 @@ text_window_realize (GtkTextWindow *win,
|
||||
if (win->type == GTK_TEXT_WINDOW_TEXT &&
|
||||
gtk_widget_is_sensitive (widget))
|
||||
{
|
||||
display = gdk_window_get_display (window);
|
||||
cursor = gdk_cursor_new_from_name (display, "text");
|
||||
cursor = gdk_cursor_new_from_name ("text", NULL);
|
||||
gdk_window_set_cursor (win->bin_window, cursor);
|
||||
g_clear_object (&cursor);
|
||||
|
||||
|
@ -4507,8 +4507,7 @@ gtk_tree_view_motion (GtkWidget *widget,
|
||||
|
||||
if (_gtk_tree_view_column_coords_in_resize_rect (column, x, y))
|
||||
{
|
||||
GdkDisplay *display = gtk_widget_get_display (widget);
|
||||
GdkCursor *cursor = gdk_cursor_new_from_name (display, "col-resize");
|
||||
GdkCursor *cursor = gdk_cursor_new_from_name ("col-resize", NULL);
|
||||
|
||||
gtk_widget_set_cursor (widget, cursor);
|
||||
g_object_unref (cursor);
|
||||
|
@ -1843,8 +1843,7 @@ captured_event_cb (GtkWidget *widget,
|
||||
{
|
||||
if (edge_under_coordinates (GTK_WINDOW (widget), x, y, i))
|
||||
{
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget),
|
||||
cursor_names[i]);
|
||||
cursor = gdk_cursor_new_from_name (cursor_names[i], NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ gtk_inspector_on_inspect (GtkWidget *button,
|
||||
}
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
cursor = gdk_cursor_new_from_name (display, "crosshair");
|
||||
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
|
||||
status = gdk_seat_grab (gdk_display_get_default_seat (display),
|
||||
gtk_widget_get_window (iw->invisible),
|
||||
GDK_SEAT_CAPABILITY_ALL_POINTING, TRUE,
|
||||
|
@ -3852,12 +3852,12 @@ set_cursor_from_name (GtkWidget *entry,
|
||||
GdkCursor *cursor;
|
||||
|
||||
name = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), name);
|
||||
cursor = gdk_cursor_new_from_name (name, NULL);
|
||||
|
||||
if (cursor == NULL)
|
||||
{
|
||||
name = NULL;
|
||||
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "none");
|
||||
cursor = gdk_cursor_new_from_name ("none", NULL);
|
||||
}
|
||||
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
|
||||
@ -7020,7 +7020,7 @@ snapshot_widget (GtkButton *button,
|
||||
data->is_toplevel = widget == data->toplevel_button;
|
||||
|
||||
if (!data->cursor)
|
||||
data->cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "crosshair");
|
||||
data->cursor = gdk_cursor_new_from_name ("crosshair", NULL);
|
||||
|
||||
gdk_seat_grab (gdk_device_get_seat (device),
|
||||
gtk_widget_get_window (widget),
|
||||
|
Loading…
Reference in New Issue
Block a user