GTK_STYLE_CLASS_CURSOR_HANDLE);
if (pos == GTK_TEXT_HANDLE_POSITION_SELECTION_END)
- gtk_style_context_add_class (priv->style_context,
- GTK_STYLE_CLASS_BOTTOM);
+ {
+ gtk_style_context_add_class (priv->style_context,
+ GTK_STYLE_CLASS_BOTTOM);
+
+ if (priv->mode == GTK_TEXT_HANDLE_MODE_CURSOR)
+ gtk_style_context_add_class (priv->style_context,
+ GTK_STYLE_CLASS_INSERTION_CURSOR);
+ }
else
gtk_style_context_add_class (priv->style_context,
GTK_STYLE_CLASS_TOP);
}
static void
-_gtk_text_handle_update_shape (GtkTextHandle *handle,
- GdkWindow *window)
+_gtk_text_handle_update_shape (GtkTextHandle *handle,
+ GdkWindow *window,
+ GtkTextHandlePosition pos)
{
GtkTextHandlePrivate *priv;
+ cairo_surface_t *surface;
+ cairo_region_t *region;
+ cairo_t *cr;
priv = handle->priv;
+ surface =
+ gdk_window_create_similar_surface (window,
+ CAIRO_CONTENT_COLOR_ALPHA,
+ gdk_window_get_width (window),
+ gdk_window_get_height (window));
+
+ cr = cairo_create (surface);
+ _gtk_text_handle_draw (handle, cr, pos);
+ cairo_destroy (cr);
+
+ region = gdk_cairo_region_create_from_surface (surface);
+
if (gtk_widget_is_composited (priv->parent))
gdk_window_shape_combine_region (window, NULL, 0, 0);
else
- {
- GtkTextHandlePosition pos;
- cairo_surface_t *surface;
- cairo_region_t *region;
- cairo_t *cr;
-
- if (window == priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].window)
- pos = GTK_TEXT_HANDLE_POSITION_SELECTION_START;
- else if (window == priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].window)
- pos = GTK_TEXT_HANDLE_POSITION_SELECTION_END;
- else
- return;
-
- surface =
- gdk_window_create_similar_surface (window,
- CAIRO_CONTENT_COLOR_ALPHA,
- gdk_window_get_width (window),
- gdk_window_get_height (window));
-
- cr = cairo_create (surface);
- _gtk_text_handle_draw (handle, cr, pos);
- cairo_destroy (cr);
+ gdk_window_shape_combine_region (window, region, 0, 0);
- region = gdk_cairo_region_create_from_surface (surface);
- gdk_window_shape_combine_region (window, region, 0, 0);
+ gdk_window_input_shape_combine_region (window, region, 0, 0);
- cairo_surface_destroy (surface);
- cairo_region_destroy (region);
- }
+ cairo_surface_destroy (surface);
+ cairo_region_destroy (region);
}
static GdkWindow *
-_gtk_text_handle_create_window (GtkTextHandle *handle)
+_gtk_text_handle_create_window (GtkTextHandle *handle,
+ GtkTextHandlePosition pos)
{
GtkTextHandlePrivate *priv;
GdkRGBA bg = { 0, 0, 0, 0 };
gdk_window_set_user_data (window, priv->parent);
gdk_window_set_background_rgba (window, &bg);
- _gtk_text_handle_update_shape (handle, window);
+ _gtk_text_handle_update_shape (handle, window, pos);
return window;
}
gdk_window_destroy (handle_window->window);
/* Create new window and apply old state */
- handle_window->window = _gtk_text_handle_create_window (handle);
+ handle_window->window = _gtk_text_handle_create_window (handle, pos);
if (visible)
{
{
priv->relative_to = g_object_ref (window);
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].window =
- _gtk_text_handle_create_window (handle);
+ _gtk_text_handle_create_window (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_START);
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].window =
- _gtk_text_handle_create_window (handle);
+ _gtk_text_handle_create_window (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_END);
priv->realized = TRUE;
}
else
}
priv->mode = mode;
+
+ _gtk_text_handle_update_shape (handle,
+ priv->windows[GTK_TEXT_HANDLE_POSITION_CURSOR].window,
+ GTK_TEXT_HANDLE_POSITION_CURSOR);
}
GtkTextHandleMode