summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2016-10-05 17:23:29 +0200
committerBenjamin Otte <otte@redhat.com>2016-10-16 18:17:21 +0200
commit9fd1a1bbe30fba7a28877871da5b412db6f101c0 (patch)
treeba88d1c7ece429da0105c7fbad0749701617876f /gtk
parentccd3ff7fbae190305c2821deed6ebafa115ab4cf (diff)
downloadgtk+-9fd1a1bbe30fba7a28877871da5b412db6f101c0.tar.gz
widget: Remove cursor-aspect-ratio/window-dragging style properties
And replaces its usages in GtkTextView/GtkStyleContext with a hard-coded 0.04 which was the default value for cursor-aspect-ratio. Also remove the public gtk_draw_insertion_cursor which used draw_insertion_cursor which in turn looked up cursor-aspect-ratio
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkstylecontext.c49
-rw-r--r--gtk/gtkstylecontext.h7
-rw-r--r--gtk/gtkwidget.c7
-rw-r--r--gtk/gtkwindow.c11
4 files changed, 7 insertions, 67 deletions
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 1989056cff..00c597e0ce 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -123,6 +123,7 @@
* %GTK_STYLE_PROVIDER_PRIORITY_USER priority.
*/
+#define CURSOR_ASPECT_RATIO (0.04)
typedef struct PropertyValue PropertyValue;
struct PropertyValue
@@ -2766,7 +2767,6 @@ draw_insertion_cursor (GtkStyleContext *context,
{
GdkRGBA primary_color;
GdkRGBA secondary_color;
- gfloat cursor_aspect_ratio;
gint stem_width;
gint offset;
@@ -2780,11 +2780,7 @@ draw_insertion_cursor (GtkStyleContext *context,
* propagate the changes to gtktextview.c:text_window_invalidate_cursors().
*/
- gtk_style_context_get_style (context,
- "cursor-aspect-ratio", &cursor_aspect_ratio,
- NULL);
-
- stem_width = height * cursor_aspect_ratio + 1;
+ stem_width = height * CURSOR_ASPECT_RATIO + 1;
/* put (stem_width % 2) on the proper side of the cursor */
if (direction == PANGO_DIRECTION_LTR)
@@ -2917,47 +2913,6 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
}
/**
- * gtk_draw_insertion_cursor:
- * @widget: a #GtkWidget
- * @cr: cairo context to draw to
- * @location: location where to draw the cursor (@location->width is ignored)
- * @is_primary: if the cursor should be the primary cursor color.
- * @direction: whether the cursor is left-to-right or
- * right-to-left. Should never be #GTK_TEXT_DIR_NONE
- * @draw_arrow: %TRUE to draw a directional arrow on the
- * cursor. Should be %FALSE unless the cursor is split.
- *
- * Draws a text caret on @cr at @location. This is not a style function
- * but merely a convenience function for drawing the standard cursor shape.
- *
- * Since: 3.0
- * Deprecated: 3.4: Use gtk_render_insertion_cursor() instead.
- */
-void
-gtk_draw_insertion_cursor (GtkWidget *widget,
- cairo_t *cr,
- const GdkRectangle *location,
- gboolean is_primary,
- GtkTextDirection direction,
- gboolean draw_arrow)
-{
- GtkStyleContext *context;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (cr != NULL);
- g_return_if_fail (location != NULL);
- g_return_if_fail (direction != GTK_TEXT_DIR_NONE);
-
- context = gtk_widget_get_style_context (widget);
-
- draw_insertion_cursor (context, cr,
- location->x, location->y, location->height,
- is_primary,
- (direction == GTK_TEXT_DIR_RTL) ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR,
- draw_arrow);
-}
-
-/**
* gtk_style_context_get_change:
* @context: the context to query
*
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index f6838bb3eb..48875a52fc 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -1237,13 +1237,6 @@ void gtk_render_insertion_cursor
PangoLayout *layout,
int index,
PangoDirection direction);
-GDK_DEPRECATED_IN_3_4
-void gtk_draw_insertion_cursor (GtkWidget *widget,
- cairo_t *cr,
- const GdkRectangle *location,
- gboolean is_primary,
- GtkTextDirection direction,
- gboolean draw_arrow);
typedef enum {
GTK_STYLE_CONTEXT_PRINT_NONE = 0,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 32c5fa8af6..04075be200 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3268,13 +3268,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_TYPE_WIDGET_HELP_TYPE,
GTK_WIDGET_HELP_WHATS_THIS);
- gtk_widget_class_install_style_property (klass,
- g_param_spec_boolean ("window-dragging",
- P_("Window dragging"),
- P_("Whether windows can be dragged and maximized by clicking on empty areas"),
- FALSE,
- GTK_PARAM_READABLE));
-
gtk_widget_class_set_accessible_type (klass, GTK_TYPE_WIDGET_ACCESSIBLE);
gtk_widget_class_set_css_name (klass, "widget");
}
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f47a50ad4a..8e2875fadc 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1435,7 +1435,9 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
{
case GTK_WINDOW_REGION_CONTENT:
if (event_widget != widget)
- gtk_widget_style_get (event_widget, "window-dragging", &window_drag, NULL);
+ {
+ /* TODO: Have some way of enabling/disabling window-dragging on random widgets */
+ }
if (!window_drag)
{
@@ -1484,8 +1486,7 @@ drag_gesture_begin_cb (GtkGestureDrag *gesture,
{
GdkEventSequence *sequence;
GtkWindowRegion region;
- GtkWidget *event_widget;
- gboolean widget_drag;
+ gboolean widget_drag = FALSE;
const GdkEvent *event;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
@@ -1502,9 +1503,7 @@ drag_gesture_begin_cb (GtkGestureDrag *gesture,
/* Claim it */
break;
case GTK_WINDOW_REGION_CONTENT:
- event_widget = gtk_get_event_widget ((GdkEvent *) event);
-
- gtk_widget_style_get (event_widget, "window-dragging", &widget_drag, NULL);
+ /* TODO: Have some way of enabling/disabling window-dragging on random widgets */
if (!widget_drag)
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);