[gtk+] testgtk: Remove resize grips example
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] testgtk: Remove resize grips example
- Date: Tue, 20 Dec 2016 17:16:08 +0000 (UTC)
commit f2f5941d651c1f6339f07410ca419c2a08f06169
Author: Benjamin Otte <otte redhat com>
Date: Mon Dec 19 18:21:59 2016 +0100
testgtk: Remove resize grips example
Resize grips are gone. And just showing an empty window is not terribly
exciting.
tests/testgtk.c | 185 -------------------------------------------------------
1 files changed, 0 insertions(+), 185 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 2b380d9..abefd0c 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -1706,190 +1706,6 @@ create_reparent (GtkWidget *widget)
}
/*
- * Resize Grips
- */
-static gboolean
-grippy_button_press (GtkWidget *area, GdkEventButton *event, GdkWindowEdge edge)
-{
- if (event->type == GDK_BUTTON_PRESS)
- {
- if (event->button == GDK_BUTTON_PRIMARY)
- gtk_window_begin_resize_drag (GTK_WINDOW (gtk_widget_get_toplevel (area)), edge,
- event->button, event->x_root, event->y_root,
- event->time);
- else if (event->button == GDK_BUTTON_MIDDLE)
- gtk_window_begin_move_drag (GTK_WINDOW (gtk_widget_get_toplevel (area)),
- event->button, event->x_root, event->y_root,
- event->time);
- }
- return TRUE;
-}
-
-static gboolean
-grippy_draw (GtkWidget *area, cairo_t *cr, GdkWindowEdge edge)
-{
- GtkStyleContext *context;
- GtkJunctionSides sides;
-
- switch (edge)
- {
- case GDK_WINDOW_EDGE_NORTH_WEST:
- sides = GTK_JUNCTION_CORNER_TOPLEFT;
- break;
- case GDK_WINDOW_EDGE_NORTH:
- sides = GTK_JUNCTION_TOP;
- break;
- case GDK_WINDOW_EDGE_NORTH_EAST:
- sides = GTK_JUNCTION_CORNER_TOPRIGHT;
- break;
- case GDK_WINDOW_EDGE_WEST:
- sides = GTK_JUNCTION_LEFT;
- break;
- case GDK_WINDOW_EDGE_EAST:
- sides = GTK_JUNCTION_RIGHT;
- break;
- case GDK_WINDOW_EDGE_SOUTH_WEST:
- sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
- break;
- case GDK_WINDOW_EDGE_SOUTH:
- sides = GTK_JUNCTION_BOTTOM;
- break;
- case GDK_WINDOW_EDGE_SOUTH_EAST:
- sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
- break;
- default:
- g_assert_not_reached();
- }
-
- context = gtk_widget_get_style_context (area);
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, "grip");
- gtk_style_context_set_junction_sides (context, sides);
- gtk_render_handle (context, cr,
- 0, 0,
- gtk_widget_get_allocated_width (area),
- gtk_widget_get_allocated_height (area));
-
- gtk_style_context_restore (context);
-
- return TRUE;
-}
-
-static void
-create_resize_grips (GtkWidget *widget)
-{
- static GtkWidget *window = NULL;
- GtkWidget *area;
- GtkWidget *hbox, *vbox;
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (widget));
-
- gtk_window_set_title (GTK_WINDOW (window), "resize grips");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
-
- /* North west */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_WEST));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_WEST));
-
- /* North */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH));
-
- /* North east */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_EAST));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_EAST));
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
-
- /* West */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_WEST));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_WEST));
-
- /* Middle */
- area = gtk_drawing_area_new ();
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
-
- /* East */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_EAST));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_EAST));
-
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
-
- /* South west */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_WEST));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_WEST));
- /* South */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH));
-
- /* South east */
- area = gtk_drawing_area_new ();
- gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
- gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE);
- g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_EAST));
- g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
- GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_EAST));
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
* Saved Position
*/
gint upositionx = 0;
@@ -8842,7 +8658,6 @@ struct {
{ "radio buttons", create_radio_buttons },
{ "range controls", create_range_controls },
{ "reparent", create_reparent },
- { "resize grips", create_resize_grips },
{ "rotated label", create_rotated_label },
{ "rotated text", create_rotated_text },
{ "saved position", create_saved_position },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]