mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-28 04:02:16 -05:00
Initial work replacing dnd's gdk drawing with cairo
This commit is contained in:
parent
7769de4018
commit
218ad519e9
@ -207,7 +207,7 @@ if test "$gtkfe" = yes ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
|
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
|
||||||
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED"
|
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED"
|
||||||
|
|
||||||
dnl *********************************************************************
|
dnl *********************************************************************
|
||||||
dnl ** MAC_INTEGRATION **************************************************
|
dnl ** MAC_INTEGRATION **************************************************
|
||||||
|
@ -3842,18 +3842,17 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
|
|||||||
gboolean
|
gboolean
|
||||||
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
cairo_t *cr;
|
||||||
GdkColor col;
|
|
||||||
GdkGCValues val;
|
|
||||||
int half, width, height;
|
int half, width, height;
|
||||||
int ox, oy;
|
int ox, oy;
|
||||||
GdkDrawable *draw;
|
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
|
||||||
/* ignore file drops */
|
/* ignore file drops */
|
||||||
if (!mg_is_gui_target (context))
|
if (!mg_is_gui_target (context))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
gtk_widget_set_app_paintable (widget, TRUE);
|
||||||
|
|
||||||
if (scbar) /* scrollbar */
|
if (scbar) /* scrollbar */
|
||||||
{
|
{
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
@ -3861,55 +3860,28 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
|
|||||||
oy = allocation.y;
|
oy = allocation.y;
|
||||||
width = allocation.width;
|
width = allocation.width;
|
||||||
height = allocation.height;
|
height = allocation.height;
|
||||||
draw = gtk_widget_get_window (widget);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ox = oy = 0;
|
ox = oy = 0;
|
||||||
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
||||||
height = gdk_window_get_height (gtk_widget_get_window (widget));
|
height = gdk_window_get_height (gtk_widget_get_window (widget));
|
||||||
draw = gtk_widget_get_window (widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val.subwindow_mode = GDK_INCLUDE_INFERIORS;
|
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||||
val.graphics_exposures = 0;
|
cairo_set_source_rgb (cr, 0, 0, 1.0);
|
||||||
val.function = GDK_XOR;
|
cairo_set_line_width (cr, 0.1);
|
||||||
|
|
||||||
gc = gdk_gc_new_with_values (gtk_widget_get_window (widget), &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION);
|
|
||||||
col.red = rand() % 0xffff;
|
|
||||||
col.green = rand() % 0xffff;
|
|
||||||
col.blue = rand() % 0xffff;
|
|
||||||
gdk_colormap_alloc_color (gtk_widget_get_colormap (widget), &col, FALSE, TRUE);
|
|
||||||
gdk_gc_set_foreground (gc, &col);
|
|
||||||
|
|
||||||
half = height / 2;
|
half = height / 2;
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* are both tree/userlist on the same side? */
|
|
||||||
paned = (GtkPaned *)widget->parent->parent;
|
|
||||||
if (paned->child1 != NULL && paned->child2 != NULL)
|
|
||||||
{
|
|
||||||
gdk_draw_rectangle (draw, gc, 0, 1, 2, width - 3, height - 4);
|
|
||||||
gdk_draw_rectangle (draw, gc, 0, 0, 1, width - 1, height - 2);
|
|
||||||
g_object_unref (gc);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (y < half)
|
if (y < half)
|
||||||
{
|
cairo_rectangle (cr, ox, oy, width, half);
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 1 + ox, 2 + oy, width - 3, half - 4);
|
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 0 + ox, 1 + oy, width - 1, half - 2);
|
|
||||||
gtk_widget_queue_draw_area (widget, ox, half + oy, width, height - half);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
cairo_rectangle (cr, ox, half + oy, width, half);
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 0 + ox, half + 1 + oy, width - 1, half - 2);
|
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 1 + ox, half + 2 + oy, width - 3, half - 4);
|
|
||||||
gtk_widget_queue_draw_area (widget, ox, oy, width, half);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (gc);
|
cairo_stroke (cr);
|
||||||
|
cairo_destroy (cr);
|
||||||
|
|
||||||
|
gtk_widget_queue_draw_area (widget, ox, oy, width, height);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user