forked from AuroraMiddleware/gtk
Comment out some unused code, and fix the reference point of composited
2006-02-27 Matthias Clasen <mclasen@redhat.com> * gtk/gtkdnd.c (gtk_drag_get_cursor): Comment out some unused code, and fix the reference point of composited drag cursors. (#320132, Christian Neumair)
This commit is contained in:
parent
cee36ddec5
commit
aaed59e21d
@ -1,9 +1,16 @@
|
|||||||
|
2006-02-27 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkdnd.c (gtk_drag_get_cursor): Comment out some unused
|
||||||
|
code, and fix the reference point of composited drag cursors.
|
||||||
|
(#320132, Christian Neumair)
|
||||||
|
|
||||||
Sun Feb 26 10:24:10 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
Sun Feb 26 10:24:10 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
||||||
|
|
||||||
*gdk/directfb/README
|
*gdk/directfb/README
|
||||||
Updated README to remove old build instructions
|
Updated README to remove old build instructions
|
||||||
|
|
||||||
Sat Feb 25 10:35:23 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
Sat Feb 25 10:35:23 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
||||||
|
|
||||||
*gdk/directfb/gdkdisplay-directfb.c
|
*gdk/directfb/gdkdisplay-directfb.c
|
||||||
*gdk/directfb/gdkwindow-directfb.c
|
*gdk/directfb/gdkwindow-directfb.c
|
||||||
Added stubs for shape window functions to fix compile problems
|
Added stubs for shape window functions to fix compile problems
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
|
2006-02-27 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkdnd.c (gtk_drag_get_cursor): Comment out some unused
|
||||||
|
code, and fix the reference point of composited drag cursors.
|
||||||
|
(#320132, Christian Neumair)
|
||||||
|
|
||||||
Sun Feb 26 10:24:10 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
Sun Feb 26 10:24:10 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
||||||
|
|
||||||
*gdk/directfb/README
|
*gdk/directfb/README
|
||||||
Updated README to remove old build instructions
|
Updated README to remove old build instructions
|
||||||
|
|
||||||
Sat Feb 25 10:35:23 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
Sat Feb 25 10:35:23 PST 2006 Michael Emmel <mike.emmel@gmail.com>
|
||||||
|
|
||||||
*gdk/directfb/gdkdisplay-directfb.c
|
*gdk/directfb/gdkdisplay-directfb.c
|
||||||
*gdk/directfb/gdkwindow-directfb.c
|
*gdk/directfb/gdkwindow-directfb.c
|
||||||
Added stubs for shape window functions to fix compile problems
|
Added stubs for shape window functions to fix compile problems
|
||||||
|
107
gtk/gtkdnd.c
107
gtk/gtkdnd.c
@ -592,10 +592,8 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
gint icon_width, icon_height;
|
gint icon_width, icon_height;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
GdkPixbuf *cursor_pixbuf, *pixbuf;
|
GdkPixbuf *cursor_pixbuf, *pixbuf;
|
||||||
GtkAnchorType icon_anchor;
|
gint hot_x, hot_y;
|
||||||
gint hot_x = 0, hot_y = 0;
|
|
||||||
gint icon_x, icon_y, ref_x, ref_y;
|
gint icon_x, icon_y, ref_x, ref_y;
|
||||||
gboolean found;
|
|
||||||
|
|
||||||
if (info->drag_cursors[i] != NULL)
|
if (info->drag_cursors[i] != NULL)
|
||||||
{
|
{
|
||||||
@ -606,13 +604,12 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
info->drag_cursors[i] = NULL;
|
info->drag_cursors[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hot_x = hot_y = 0;
|
||||||
|
icon_x = info->hot_x;
|
||||||
|
icon_y = info->hot_y;
|
||||||
cursor_pixbuf = gdk_cursor_get_image (drag_cursors[i].cursor);
|
cursor_pixbuf = gdk_cursor_get_image (drag_cursors[i].cursor);
|
||||||
if (!cursor_pixbuf)
|
if (!cursor_pixbuf)
|
||||||
{
|
cursor_pixbuf = g_object_ref (drag_cursors[i].pixbuf);
|
||||||
cursor_pixbuf = g_object_ref (drag_cursors[i].pixbuf);
|
|
||||||
icon_anchor = GTK_ANCHOR_NORTH_WEST;
|
|
||||||
icon_x = icon_y = -2;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gdk_pixbuf_get_option (cursor_pixbuf, "x_hot"))
|
if (gdk_pixbuf_get_option (cursor_pixbuf, "x_hot"))
|
||||||
@ -621,12 +618,31 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
if (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"))
|
if (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"))
|
||||||
hot_y = atoi (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"));
|
hot_y = atoi (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"));
|
||||||
|
|
||||||
found = FALSE;
|
#if 0
|
||||||
|
/* The code below is an attempt to let cursor themes
|
||||||
|
* determine the attachment of the icon to enable things
|
||||||
|
* like the following:
|
||||||
|
*
|
||||||
|
* +-----+
|
||||||
|
* | |
|
||||||
|
* | ||
|
||||||
|
* +-----+|
|
||||||
|
* ---+
|
||||||
|
*
|
||||||
|
* It does not work since Xcursor doesn't allow to attach
|
||||||
|
* any additional information to cursors in a retrievable
|
||||||
|
* way (there are comments, but no way to get at them
|
||||||
|
* short of searching for the actual cursor file).
|
||||||
|
* If this code ever gets used, the icon_window placement
|
||||||
|
* must be changed to recognize these placement options
|
||||||
|
* as well. Note that this code ignores info->hot_x/y.
|
||||||
|
*/
|
||||||
for (j = 0; j < 10; j++)
|
for (j = 0; j < 10; j++)
|
||||||
{
|
{
|
||||||
const gchar *opt;
|
const gchar *opt;
|
||||||
gchar key[32];
|
gchar key[32];
|
||||||
gchar **toks;
|
gchar **toks;
|
||||||
|
GtkAnchorType icon_anchor;
|
||||||
|
|
||||||
g_snprintf (key, 32, "comment%d", j);
|
g_snprintf (key, 32, "comment%d", j);
|
||||||
opt = gdk_pixbuf_get_option (cursor_pixbuf, key);
|
opt = gdk_pixbuf_get_option (cursor_pixbuf, key);
|
||||||
@ -641,18 +657,42 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
icon_anchor = atoi (toks[0]);
|
icon_anchor = atoi (toks[0]);
|
||||||
icon_x = atoi (toks[1]);
|
icon_x = atoi (toks[1]);
|
||||||
icon_y = atoi (toks[2]);
|
icon_y = atoi (toks[2]);
|
||||||
|
|
||||||
|
switch (icon_anchor)
|
||||||
|
{
|
||||||
|
case GTK_ANCHOR_NORTH:
|
||||||
|
case GTK_ANCHOR_CENTER:
|
||||||
|
case GTK_ANCHOR_SOUTH:
|
||||||
|
icon_x += icon_width / 2;
|
||||||
|
break;
|
||||||
|
case GTK_ANCHOR_NORTH_EAST:
|
||||||
|
case GTK_ANCHOR_EAST:
|
||||||
|
case GTK_ANCHOR_SOUTH_EAST:
|
||||||
|
icon_x += icon_width;
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (icon_anchor)
|
||||||
|
{
|
||||||
|
case GTK_ANCHOR_WEST:
|
||||||
|
case GTK_ANCHOR_CENTER:
|
||||||
|
case GTK_ANCHOR_EAST:
|
||||||
|
icon_y += icon_height / 2;
|
||||||
|
break;
|
||||||
|
case GTK_ANCHOR_SOUTH_WEST:
|
||||||
|
case GTK_ANCHOR_SOUTH:
|
||||||
|
case GTK_ANCHOR_SOUTH_EAST:
|
||||||
|
icon_x += icon_height;
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
|
||||||
g_strfreev (toks);
|
g_strfreev (toks);
|
||||||
found = TRUE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
#endif
|
||||||
{
|
|
||||||
icon_anchor = GTK_ANCHOR_NORTH_WEST;
|
|
||||||
icon_x = (gint) -2 * gdk_pixbuf_get_width (cursor_pixbuf) / 16.0;
|
|
||||||
icon_y = (gint) -2 * gdk_pixbuf_get_height (cursor_pixbuf) / 16.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
icon_width = gdk_pixbuf_get_width (info->icon_pixbuf);
|
icon_width = gdk_pixbuf_get_width (info->icon_pixbuf);
|
||||||
@ -660,36 +700,6 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
cursor_width = gdk_pixbuf_get_width (cursor_pixbuf);
|
cursor_width = gdk_pixbuf_get_width (cursor_pixbuf);
|
||||||
cursor_height = gdk_pixbuf_get_height (cursor_pixbuf);
|
cursor_height = gdk_pixbuf_get_height (cursor_pixbuf);
|
||||||
|
|
||||||
switch (icon_anchor)
|
|
||||||
{
|
|
||||||
case GTK_ANCHOR_NORTH:
|
|
||||||
case GTK_ANCHOR_CENTER:
|
|
||||||
case GTK_ANCHOR_SOUTH:
|
|
||||||
icon_x += icon_width / 2;
|
|
||||||
break;
|
|
||||||
case GTK_ANCHOR_NORTH_EAST:
|
|
||||||
case GTK_ANCHOR_EAST:
|
|
||||||
case GTK_ANCHOR_SOUTH_EAST:
|
|
||||||
icon_x += icon_width;
|
|
||||||
break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (icon_anchor)
|
|
||||||
{
|
|
||||||
case GTK_ANCHOR_WEST:
|
|
||||||
case GTK_ANCHOR_CENTER:
|
|
||||||
case GTK_ANCHOR_EAST:
|
|
||||||
icon_y += icon_height / 2;
|
|
||||||
break;
|
|
||||||
case GTK_ANCHOR_SOUTH_WEST:
|
|
||||||
case GTK_ANCHOR_SOUTH:
|
|
||||||
case GTK_ANCHOR_SOUTH_EAST:
|
|
||||||
icon_x += icon_height;
|
|
||||||
break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
|
|
||||||
ref_x = MAX (hot_x, icon_x);
|
ref_x = MAX (hot_x, icon_x);
|
||||||
ref_y = MAX (hot_y, icon_y);
|
ref_y = MAX (hot_y, icon_y);
|
||||||
width = ref_x + MAX (cursor_width - hot_x, icon_width - icon_x);
|
width = ref_x + MAX (cursor_width - hot_x, icon_width - icon_x);
|
||||||
@ -697,6 +707,9 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
|
|
||||||
if (gtk_drag_can_use_rgba_cursor (display, width, height))
|
if (gtk_drag_can_use_rgba_cursor (display, width, height))
|
||||||
{
|
{
|
||||||
|
/* Composite cursor and icon so that both hotspots
|
||||||
|
* end up at (ref_x, ref_y)
|
||||||
|
*/
|
||||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
@ -717,7 +730,7 @@ gtk_drag_get_cursor (GdkDisplay *display,
|
|||||||
GDK_INTERP_BILINEAR, 255);
|
GDK_INTERP_BILINEAR, 255);
|
||||||
|
|
||||||
info->drag_cursors[i] =
|
info->drag_cursors[i] =
|
||||||
gdk_cursor_new_from_pixbuf (display, pixbuf, 0, 0);
|
gdk_cursor_new_from_pixbuf (display, pixbuf, ref_x, ref_y);
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user