[gtk+/touch-selection-fixes: 1/3] texthandle: Fix shape setup on non-composited environments
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touch-selection-fixes: 1/3] texthandle: Fix shape setup on non-composited environments
- Date: Fri, 26 Oct 2012 16:39:33 +0000 (UTC)
commit f6952ceb827d6f8d1fe7010b4a0c70f41b0679ba
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Oct 26 17:46:40 2012 +0200
texthandle: Fix shape setup on non-composited environments
The check on the handle to be drawn on the mask was based on the yet to
be set priv->windows pointers, pass explicitly the handle position to
have the shape correctly initialized on non-composited environments
gtk/gtktexthandle.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 3738d02..a0d3ae2 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -122,8 +122,9 @@ _gtk_text_handle_draw (GtkTextHandle *handle,
}
static void
-_gtk_text_handle_update_shape (GtkTextHandle *handle,
- GdkWindow *window)
+_gtk_text_handle_update_shape (GtkTextHandle *handle,
+ GdkWindow *window,
+ GtkTextHandlePosition pos)
{
GtkTextHandlePrivate *priv;
@@ -133,18 +134,10 @@ _gtk_text_handle_update_shape (GtkTextHandle *handle,
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,
@@ -164,7 +157,8 @@ _gtk_text_handle_update_shape (GtkTextHandle *handle,
}
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 };
@@ -200,7 +194,7 @@ _gtk_text_handle_create_window (GtkTextHandle *handle)
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;
}
@@ -307,7 +301,7 @@ _gtk_text_handle_update_window (GtkTextHandle *handle,
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)
{
@@ -531,9 +525,9 @@ _gtk_text_handle_set_relative_to (GtkTextHandle *handle,
{
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]