Patch 8.1.0368
Problem: GTK code has too many #ifdefs and building fails with GTK 2.10.
Solution: Always use gtk_widget_get_window() and define it for older GTK
versions. (Ken Takata, closes #3421)
Files: src/gui_beval.c, src/gui_gtk.c, src/gui_gtk_f.c,
src/gui_gtk_x11.c, src/mbyte.c, src/vim.h
*** ../vim-8.1.0367/src/gui_beval.c 2018-08-28 23:09:03.889824461 +0200
--- src/gui_beval.c 2018-09-11 21:18:17.858739747 +0200
***************
*** 991,1001 ****
# endif
/* Compute position of the balloon area */
- # if GTK_CHECK_VERSION(3,0,0)
gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y);
- # else
- gdk_window_get_origin(beval->target->window, &x, &y);
- # endif
x += beval->x;
y += beval->y;
--- 991,997 ----
*** ../vim-8.1.0367/src/gui_gtk.c 2018-02-04 14:33:59.000000000 +0100
--- src/gui_gtk.c 2018-09-11 21:18:17.862739715 +0200
***************
*** 1932,1942 ****
gboolean *push_in UNUSED,
gpointer user_data UNUSED)
{
- # if GTK_CHECK_VERSION(3,0,0)
gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), x, y);
- # else
- gdk_window_get_origin(gui.drawarea->window, x, y);
- # endif
if (popup_mouse_pos)
{
--- 1932,1938 ----
***************
*** 1946,1957 ****
*x += mx;
*y += my;
}
- # if GTK_CHECK_VERSION(3,0,0)
else if (curwin != NULL && gui.drawarea != NULL &&
gtk_widget_get_window(gui.drawarea) != NULL)
- # else
- else if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window
!= NULL)
- # endif
{
/* Find the cursor position in the current window */
*x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1;
--- 1942,1949 ----
*** ../vim-8.1.0367/src/gui_gtk_f.c 2017-04-09 15:23:59.000000000 +0200
--- src/gui_gtk_f.c 2018-09-11 21:18:17.862739715 +0200
***************
*** 345,368 ****
gtk_widget_set_window(widget,
gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask));
- gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
#else
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask);
- gdk_window_set_user_data(widget->window, widget);
#endif
attributes.x = 0;
attributes.y = 0;
attributes.event_mask = gtk_widget_get_events(widget);
- #if GTK_CHECK_VERSION(3,0,0)
form->bin_window = gdk_window_new(gtk_widget_get_window(widget),
&attributes, attributes_mask);
- #else
- form->bin_window = gdk_window_new(widget->window,
- &attributes, attributes_mask);
- #endif
gdk_window_set_user_data(form->bin_window, widget);
#if GTK_CHECK_VERSION(3,0,0)
--- 345,362 ----
gtk_widget_set_window(widget,
gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask));
#else
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask);
#endif
+ gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
attributes.x = 0;
attributes.y = 0;
attributes.event_mask = gtk_widget_get_events(widget);
form->bin_window = gdk_window_new(gtk_widget_get_window(widget),
&attributes, attributes_mask);
gdk_window_set_user_data(form->bin_window, widget);
#if GTK_CHECK_VERSION(3,0,0)
***************
*** 422,432 ****
GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
#endif
- #if GTK_CHECK_VERSION(3,0,0)
gdk_window_show(gtk_widget_get_window(widget));
- #else
- gdk_window_show(widget->window);
- #endif
gdk_window_show(form->bin_window);
for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
--- 416,422 ----
***************
*** 593,607 ****
if (GTK_WIDGET_REALIZED(widget))
#endif
{
- #if GTK_CHECK_VERSION(3,0,0)
gdk_window_move_resize(gtk_widget_get_window(widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
- #else
- gdk_window_move_resize(widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
- #endif
gdk_window_move_resize(GTK_FORM(widget)->bin_window,
0, 0,
allocation->width, allocation->height);
--- 583,591 ----
*** ../vim-8.1.0367/src/gui_gtk_x11.c 2018-08-19 22:58:39.779568143 +0200
--- src/gui_gtk_x11.c 2018-09-11 21:23:25.600273282 +0200
***************
*** 763,773 ****
{
if (event->type == GDK_PROPERTY_NOTIFY
&& event->state == (int)GDK_PROPERTY_NEW_VALUE
- # if GTK_CHECK_VERSION(3,0,0)
&& GDK_WINDOW_XID(event->window) == commWindow
- # else
- && GDK_WINDOW_XWINDOW(event->window) == commWindow
- # endif
&& GET_X_ATOM(event->atom) == commProperty)
{
XEvent xev;
--- 763,769 ----
***************
*** 777,788 ****
xev.xproperty.atom = commProperty;
xev.xproperty.window = commWindow;
xev.xproperty.state = PropertyNewValue;
- # if GTK_CHECK_VERSION(3,0,0)
serverEventProc(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)),
&xev, 0);
- # else
- serverEventProc(GDK_WINDOW_XDISPLAY(widget->window), &xev, 0);
- # endif
}
return FALSE;
}
--- 773,780 ----
***************
*** 2653,2669 ****
/* Fall back to old method */
/* first get the existing value */
- # if GTK_CHECK_VERSION(3,0,0)
GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);
if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win),
GDK_WINDOW_XID(mainwin_win),
&existing_atoms, &count))
- # else
- if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- GDK_WINDOW_XWINDOW(gui.mainwin->window),
- &existing_atoms, &count))
- # endif
{
Atom *new_atoms;
Atom save_yourself_xatom;
--- 2645,2655 ----
***************
*** 2685,2697 ****
{
memcpy(new_atoms, existing_atoms, count * sizeof(Atom));
new_atoms[count] = save_yourself_xatom;
- # if GTK_CHECK_VERSION(3,0,0)
XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win),
GDK_WINDOW_XID(mainwin_win),
- # else
- XSetWMProtocols(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- GDK_WINDOW_XWINDOW(gui.mainwin->window),
- # endif
new_atoms, count + 1);
vim_free(new_atoms);
}
--- 2671,2678 ----
***************
*** 2736,2748 ****
* know we are done saving ourselves. We don't want to be
* restarted, thus set argv to NULL.
*/
- # if GTK_CHECK_VERSION(3,0,0)
XSetCommand(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)),
GDK_WINDOW_XID(gtk_widget_get_window(gui.mainwin)),
- # else
- XSetCommand(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- GDK_WINDOW_XWINDOW(gui.mainwin->window),
- # endif
NULL, 0);
return GDK_FILTER_REMOVE;
}
--- 2717,2724 ----
***************
*** 2776,2793 ****
#undef magick
# undef static
- #if GTK_CHECK_VERSION(3,0,0)
GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);
- #endif
/* When started with "--echo-wid" argument, write window ID on stdout. */
if (echo_wid_arg)
{
- #if GTK_CHECK_VERSION(3,0,0)
printf("WID: %ld\n", (long)GDK_WINDOW_XID(mainwin_win));
- #else
- printf("WID: %ld\n", (long)GDK_WINDOW_XWINDOW(gui.mainwin->window));
- #endif
fflush(stdout);
}
--- 2752,2763 ----
***************
*** 2824,2840 ****
if (serverName == NULL && serverDelayedStartName != NULL)
{
/* This is a :gui command in a plain vim with no previous server */
- # if GTK_CHECK_VERSION(3,0,0)
commWindow = GDK_WINDOW_XID(mainwin_win);
(void)serverRegisterName(GDK_WINDOW_XDISPLAY(mainwin_win),
serverDelayedStartName);
- # else
- commWindow = GDK_WINDOW_XWINDOW(gui.mainwin->window);
-
- (void)serverRegisterName(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- serverDelayedStartName);
- # endif
}
else
{
--- 2794,2803 ----
***************
*** 2843,2855 ****
* have to change the "server" registration to that of the main window
* If we have not registered a name yet, remember the window.
*/
- # if GTK_CHECK_VERSION(3,0,0)
serverChangeRegisteredWindow(GDK_WINDOW_XDISPLAY(mainwin_win),
GDK_WINDOW_XID(mainwin_win));
- # else
- serverChangeRegisteredWindow(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- GDK_WINDOW_XWINDOW(gui.mainwin->window));
- # endif
}
gtk_widget_add_events(gui.mainwin, GDK_PROPERTY_CHANGE_MASK);
# if GTK_CHECK_VERSION(3,0,0)
--- 2806,2813 ----
***************
*** 2945,2958 ****
gui.blank_pointer = create_blank_pointer();
- #if GTK_CHECK_VERSION(3,0,0)
if (gui.pointer_hidden && gtk_widget_get_window(gui.drawarea) != NULL)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer);
- #else
- if (gui.pointer_hidden && gui.drawarea->window != NULL)
- gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer);
- #endif
/*
* Create a new PangoContext for this screen, and initialize it
--- 2903,2911 ----
***************
*** 3002,3012 ****
gui.blank_pointer = create_blank_pointer();
if (gui.pointer_hidden)
- #if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(widget), gui.blank_pointer);
- #else
- gdk_window_set_cursor(widget->window, gui.blank_pointer);
- #endif
/* get the actual size of the scrollbars, if they are realized */
sbar = firstwin->w_scrollbars[SBAR_LEFT].id;
--- 2955,2961 ----
***************
*** 4923,4937 ****
int
gui_mch_maximized(void)
{
- #if GTK_CHECK_VERSION(3,0,0)
return (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL
&& (gdk_window_get_state(gtk_widget_get_window(gui.mainwin))
& GDK_WINDOW_STATE_MAXIMIZED));
- #else
- return (gui.mainwin != NULL && gui.mainwin->window != NULL
- && (gdk_window_get_state(gui.mainwin->window)
- & GDK_WINDOW_STATE_MAXIMIZED));
- #endif
}
/*
--- 4872,4880 ----
***************
*** 6051,6061 ****
cairo_t *cr;
#endif
- #if GTK_CHECK_VERSION(3,0,0)
if (gui.text_context == NULL || gtk_widget_get_window(gui.drawarea) ==
NULL)
- #else
- if (gui.text_context == NULL || gui.drawarea->window == NULL)
- #endif
return len;
if (output_conv.vc_type != CONV_NONE)
--- 5994,6000 ----
***************
*** 6366,6384 ****
int
gui_get_x11_windis(Window *win, Display **dis)
{
- #if GTK_CHECK_VERSION(3,0,0)
if (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL)
- #else
- if (gui.mainwin != NULL && gui.mainwin->window != NULL)
- #endif
{
- #if GTK_CHECK_VERSION(3,0,0)
*dis = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin));
*win = GDK_WINDOW_XID(gtk_widget_get_window(gui.mainwin));
- #else
- *dis = GDK_WINDOW_XDISPLAY(gui.mainwin->window);
- *win = GDK_WINDOW_XWINDOW(gui.mainwin->window);
- #endif
return OK;
}
--- 6305,6314 ----
***************
*** 6394,6406 ****
Display *
gui_mch_get_display(void)
{
- #if GTK_CHECK_VERSION(3,0,0)
if (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL)
return GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin));
- #else
- if (gui.mainwin != NULL && gui.mainwin->window != NULL)
- return GDK_WINDOW_XDISPLAY(gui.mainwin->window);
- #endif
else
return NULL;
}
--- 6324,6331 ----
***************
*** 6555,6565 ****
cairo_t *cr;
#endif
- #if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) == NULL)
- #else
- if (gui.drawarea->window == NULL)
- #endif
return;
#if GTK_CHECK_VERSION(3,0,0)
--- 6480,6486 ----
***************
*** 6600,6610 ****
void
gui_mch_draw_part_cursor(int w, int h, guicolor_T color)
{
- #if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) == NULL)
- #else
- if (gui.drawarea->window == NULL)
- #endif
return;
gui_mch_set_fg_color(color);
--- 6521,6527 ----
***************
*** 6880,6897 ****
if (!gui.by_signal)
gdk_window_invalidate_rect(win, &rect, FALSE);
}
#endif
void
gui_mch_clear_all(void)
{
- #if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) != NULL)
gui_gtk_window_clear(gtk_widget_get_window(gui.drawarea));
- #else
- if (gui.drawarea->window != NULL)
- gdk_window_clear(gui.drawarea->window);
- #endif
}
#if !GTK_CHECK_VERSION(3,0,0)
--- 6797,6811 ----
if (!gui.by_signal)
gdk_window_invalidate_rect(win, &rect, FALSE);
}
+ #else
+ # define gui_gtk_window_clear(win) gdk_window_clear(win)
#endif
void
gui_mch_clear_all(void)
{
if (gtk_widget_get_window(gui.drawarea) != NULL)
gui_gtk_window_clear(gtk_widget_get_window(gui.drawarea));
}
#if !GTK_CHECK_VERSION(3,0,0)
***************
*** 7084,7095 ****
}
/* Final fallback position - use the X CUT_BUFFER0 store */
- #if GTK_CHECK_VERSION(3,0,0)
yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)),
cbd);
- #else
- yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gui.mainwin->window), cbd);
- #endif
}
/*
--- 6998,7005 ----
***************
*** 7269,7283 ****
/* Sorry for the Xlib call, but we can't avoid it, since there is no
* internal GDK mechanism present to accomplish this. (and for good
* reason...) */
- #if GTK_CHECK_VERSION(3,0,0)
XWarpPointer(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.drawarea)),
(Window)0, GDK_WINDOW_XID(gtk_widget_get_window(gui.drawarea)),
0, 0, 0U, 0U, x, y);
- #else
- XWarpPointer(GDK_WINDOW_XDISPLAY(gui.drawarea->window),
- (Window)0, GDK_WINDOW_XWINDOW(gui.drawarea->window),
- 0, 0, 0U, 0U, x, y);
- #endif
}
--- 7179,7187 ----
***************
*** 7298,7323 ****
if (gui.pointer_hidden != hide)
{
gui.pointer_hidden = hide;
- #if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) && gui.blank_pointer != NULL)
- #else
- if (gui.drawarea->window && gui.blank_pointer != NULL)
- #endif
{
if (hide)
- #if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer);
- #else
- gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer);
- #endif
else
#ifdef FEAT_MOUSESHAPE
mch_set_mouse_shape(last_shape);
- #elif GTK_CHECK_VERSION(3,0,0)
- gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
NULL);
#else
! gdk_window_set_cursor(gui.drawarea->window, NULL);
#endif
}
}
--- 7202,7217 ----
if (gui.pointer_hidden != hide)
{
gui.pointer_hidden = hide;
if (gtk_widget_get_window(gui.drawarea) && gui.blank_pointer != NULL)
{
if (hide)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer);
else
#ifdef FEAT_MOUSESHAPE
mch_set_mouse_shape(last_shape);
#else
! gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
NULL);
#endif
}
}
***************
*** 7354,7373 ****
int id;
GdkCursor *c;
- # if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) == NULL)
- # else
- if (gui.drawarea->window == NULL)
- # endif
return;
if (shape == MSHAPE_HIDE || gui.pointer_hidden)
- # if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer);
- # else
- gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer);
- # endif
else
{
if (shape >= MSHAPE_NUMBERED)
--- 7248,7259 ----
***************
*** 7384,7394 ****
return;
c = gdk_cursor_new_for_display(
gtk_widget_get_display(gui.drawarea), (GdkCursorType)id);
- # if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), c);
- # else
- gdk_window_set_cursor(gui.drawarea->window, c);
- # endif
# if GTK_CHECK_VERSION(3,0,0)
g_object_unref(G_OBJECT(c));
# else
--- 7270,7276 ----
***************
*** 7420,7431 ****
sign = (GdkPixbuf *)sign_get_image(typenr);
- # if GTK_CHECK_VERSION(3,0,0)
if (sign != NULL && gui.drawarea != NULL
&& gtk_widget_get_window(gui.drawarea) != NULL)
- # else
- if (sign != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL)
- # endif
{
int width;
int height;
--- 7302,7309 ----
*** ../vim-8.1.0367/src/mbyte.c 2018-08-19 22:58:39.779568143 +0200
--- src/mbyte.c 2018-09-11 21:18:17.870739650 +0200
***************
*** 4959,4969 ****
gui_gtk_get_screen_geom_of_win(gui.drawarea,
&screen_x, &screen_y, &screen_width, &screen_height);
- #if GTK_CHECK_VERSION(3,0,0)
gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
- #else
- gdk_window_get_origin(gui.drawarea->window, &x, &y);
- #endif
gtk_window_get_size(GTK_WINDOW(preedit_window), &width, &height);
x = x + FILL_X(gui.col);
y = y + FILL_Y(gui.row);
--- 4959,4965 ----
***************
*** 5565,5575 ****
#endif
g_return_if_fail(gui.drawarea != NULL);
- #if GTK_CHECK_VERSION(3,0,0)
g_return_if_fail(gtk_widget_get_window(gui.drawarea) != NULL);
- #else
- g_return_if_fail(gui.drawarea->window != NULL);
- #endif
xic = gtk_im_multicontext_new();
g_object_ref(xic);
--- 5561,5567 ----
***************
*** 5583,5593 ****
g_signal_connect(G_OBJECT(xic), "preedit_end",
G_CALLBACK(&im_preedit_end_cb), NULL);
- #if GTK_CHECK_VERSION(3,0,0)
gtk_im_context_set_client_window(xic,
gtk_widget_get_window(gui.drawarea));
- #else
- gtk_im_context_set_client_window(xic, gui.drawarea->window);
- #endif
}
void
--- 5575,5581 ----
***************
*** 5686,5702 ****
GdkEventKey *event;
event = (GdkEventKey *)gdk_event_new(GDK_KEY_PRESS);
- # if GTK_CHECK_VERSION(3,0,0)
g_object_ref(gtk_widget_get_window(gui.drawarea));
/* unreffed by gdk_event_free() */
- # else
- g_object_ref(gui.drawarea->window); /* unreffed by gdk_event_free() */
- # endif
- # if GTK_CHECK_VERSION(3,0,0)
event->window = gtk_widget_get_window(gui.drawarea);
- # else
- event->window = gui.drawarea->window;
- # endif
event->send_event = TRUE;
event->time = GDK_CURRENT_TIME;
event->state = state;
--- 5674,5682 ----
*** ../vim-8.1.0367/src/vim.h 2018-08-21 15:12:10.831801698 +0200
--- src/vim.h 2018-09-11 21:18:17.870739650 +0200
***************
*** 1241,1247 ****
#define MIN_SWAP_PAGE_SIZE 1048
#define MAX_SWAP_PAGE_SIZE 50000
! /* Special values for current_SID. */
#define SID_MODELINE -1 /* when using a modeline */
#define SID_CMDARG -2 /* for "--cmd" argument */
#define SID_CARG -3 /* for "-c" argument */
--- 1241,1247 ----
#define MIN_SWAP_PAGE_SIZE 1048
#define MAX_SWAP_PAGE_SIZE 50000
! /* Special values for current_sctx.sc_sid. */
#define SID_MODELINE -1 /* when using a modeline */
#define SID_CMDARG -2 /* for "--cmd" argument */
#define SID_CARG -3 /* for "-c" argument */
***************
*** 2329,2334 ****
--- 2329,2340 ----
# endif
#endif
+ #ifdef FEAT_GUI_GTK
+ # if !GTK_CHECK_VERSION(2,14,0)
+ # define gtk_widget_get_window(wid) ((wid)->window)
+ # endif
+ #endif
+
#ifndef FEAT_NETBEANS_INTG
# undef NBDEBUG
#endif
*** ../vim-8.1.0367/src/version.c 2018-09-11 20:10:17.138525018 +0200
--- src/version.c 2018-09-11 21:27:43.030210228 +0200
***************
*** 796,797 ****
--- 796,799 ----
{ /* Add new patch number below this line */
+ /**/
+ 368,
/**/
--
hundred-and-one symptoms of being an internet addict:
38. You wake up at 3 a.m. to go to the bathroom and stop and check your e-mail
on the way back to bed.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.