changeset 8495:8877ea0a27ec v7.4.1538

commit https://github.com/vim/vim/commit/4fc563b397949ce23190045112fa08c0776a56e6 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 12 12:40:58 2016 +0100 patch 7.4.1538 Problem: Selection with the mouse does not work in command line mode. Solution: Use cairo functions. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Sat, 12 Mar 2016 12:45:04 +0100
parents 06ad7c12876f
children 37378e4311d2
files src/gui_gtk_x11.c src/version.c
diffstat 2 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -636,7 +636,10 @@ gui_gtk3_update_cursor(cairo_t *cr)
     if (gui.row == gui.cursor_row)
     {
 	gui.by_signal = TRUE;
-	gui_update_cursor(TRUE, TRUE);
+	if (State & CMDLINE)
+	    gui_update_cursor(TRUE, FALSE);
+	else
+	    gui_update_cursor(TRUE, TRUE);
 	gui.by_signal = FALSE;
 	cairo_paint(cr);
     }
@@ -6310,8 +6313,25 @@ gui_mch_flash(int msec)
 gui_mch_invert_rectangle(int r, int c, int nr, int nc)
 {
 #if GTK_CHECK_VERSION(3,0,0)
-    /* TODO Replace GdkGC with Cairo */
-    (void)r; (void)c; (void)nr; (void)nc;
+    const GdkRectangle rect = {
+	FILL_X(c), FILL_Y(r), nc * gui.char_width, nr * gui.char_height
+    };
+    cairo_t * const cr = cairo_create(gui.surface);
+
+    set_cairo_source_rgb_from_pixel(cr, gui.norm_pixel ^ gui.back_pixel);
+# if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,2)
+    cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
+# else
+    /* Give an implementation for older cairo versions if necessary. */
+# endif
+    gdk_cairo_rectangle(cr, &rect);
+    cairo_fill(cr);
+
+    cairo_destroy(cr);
+
+    if (!gui.by_signal)
+	gtk_widget_queue_draw_area(gui.drawarea, rect.x, rect.y,
+		rect.width, rect.height);
 #else
     GdkGCValues values;
     GdkGC *invert_gc;
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1538,
+/**/
     1537,
 /**/
     1536,