forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
ccd3ff7fba
commit
9fd1a1bbe3
@ -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)
|
||||
@ -2916,47 +2912,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
|
||||
|
@ -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,
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -33,13 +33,13 @@ test_section_in_style_property (void)
|
||||
provider = gtk_css_provider_new ();
|
||||
g_signal_connect (provider, "parsing-error",
|
||||
G_CALLBACK (assert_section_is_not_null), NULL);
|
||||
gtk_css_provider_load_from_data (provider, "* { -GtkWidget-window-dragging: random garbage goes here; }", -1, NULL);
|
||||
gtk_css_provider_load_from_data (provider, "* { -GtkEntry-invisible-char: random garbage goes here; }", -1, NULL);
|
||||
|
||||
widget_class = g_type_class_ref (GTK_TYPE_WIDGET);
|
||||
pspec = gtk_widget_class_find_style_property (widget_class, "window-dragging");
|
||||
widget_class = g_type_class_ref (GTK_TYPE_ENTRY);
|
||||
pspec = gtk_widget_class_find_style_property (widget_class, "invisible-char");
|
||||
g_assert (pspec);
|
||||
path = gtk_widget_path_new ();
|
||||
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
|
||||
gtk_widget_path_append_type (path, GTK_TYPE_ENTRY);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
gtk_style_provider_get_style_property (GTK_STYLE_PROVIDER (provider), path, 0, pspec, &value);
|
||||
|
Loading…
Reference in New Issue
Block a user