mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-24 10:12:22 -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
|
||||
|
||||
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 ** MAC_INTEGRATION **************************************************
|
||||
|
@ -3842,18 +3842,17 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
|
||||
gboolean
|
||||
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
||||
{
|
||||
GdkGC *gc;
|
||||
GdkColor col;
|
||||
GdkGCValues val;
|
||||
cairo_t *cr;
|
||||
int half, width, height;
|
||||
int ox, oy;
|
||||
GdkDrawable *draw;
|
||||
GtkAllocation allocation;
|
||||
|
||||
/* ignore file drops */
|
||||
if (!mg_is_gui_target (context))
|
||||
return FALSE;
|
||||
|
||||
gtk_widget_set_app_paintable (widget, TRUE);
|
||||
|
||||
if (scbar) /* scrollbar */
|
||||
{
|
||||
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;
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
draw = gtk_widget_get_window (widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
ox = oy = 0;
|
||||
width = gdk_window_get_width (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;
|
||||
val.graphics_exposures = 0;
|
||||
val.function = GDK_XOR;
|
||||
|
||||
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);
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
cairo_set_source_rgb (cr, 0, 0, 1.0);
|
||||
cairo_set_line_width (cr, 0.1);
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
cairo_rectangle (cr, ox, oy, width, half);
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
cairo_rectangle (cr, ox, half + 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user