0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.0368: GTK code has too many #ifdefs and GTK 2.10 building fails

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)
This commit is contained in:
Bram Moolenaar 2018-09-11 21:30:09 +02:00
parent 84d9390480
commit 25328e39d2
7 changed files with 13 additions and 175 deletions

View File

@ -991,11 +991,7 @@ drawBalloon(BalloonEval *beval)
# endif # endif
/* Compute position of the balloon area */ /* 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); 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; x += beval->x;
y += beval->y; y += beval->y;

View File

@ -1932,11 +1932,7 @@ popup_menu_position_func(GtkMenu *menu UNUSED,
gboolean *push_in UNUSED, gboolean *push_in UNUSED,
gpointer user_data UNUSED) gpointer user_data UNUSED)
{ {
# if GTK_CHECK_VERSION(3,0,0)
gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), x, y); 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) if (popup_mouse_pos)
{ {
@ -1946,12 +1942,8 @@ popup_menu_position_func(GtkMenu *menu UNUSED,
*x += mx; *x += mx;
*y += my; *y += my;
} }
# if GTK_CHECK_VERSION(3,0,0)
else if (curwin != NULL && gui.drawarea != NULL && else if (curwin != NULL && gui.drawarea != NULL &&
gtk_widget_get_window(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 */ /* Find the cursor position in the current window */
*x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1; *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1;

View File

@ -345,24 +345,18 @@ gtk_form_realize(GtkWidget *widget)
gtk_widget_set_window(widget, gtk_widget_set_window(widget,
gdk_window_new(gtk_widget_get_parent_window(widget), gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask)); &attributes, attributes_mask));
gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
#else #else
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data(widget->window, widget);
#endif #endif
gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
attributes.x = 0; attributes.x = 0;
attributes.y = 0; attributes.y = 0;
attributes.event_mask = gtk_widget_get_events(widget); 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), form->bin_window = gdk_window_new(gtk_widget_get_window(widget),
&attributes, attributes_mask); &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); gdk_window_set_user_data(form->bin_window, widget);
#if GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0)
@ -422,11 +416,7 @@ gtk_form_map(GtkWidget *widget)
GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
#endif #endif
#if GTK_CHECK_VERSION(3,0,0)
gdk_window_show(gtk_widget_get_window(widget)); gdk_window_show(gtk_widget_get_window(widget));
#else
gdk_window_show(widget->window);
#endif
gdk_window_show(form->bin_window); gdk_window_show(form->bin_window);
for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
@ -593,15 +583,9 @@ gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
if (GTK_WIDGET_REALIZED(widget)) if (GTK_WIDGET_REALIZED(widget))
#endif #endif
{ {
#if GTK_CHECK_VERSION(3,0,0)
gdk_window_move_resize(gtk_widget_get_window(widget), gdk_window_move_resize(gtk_widget_get_window(widget),
allocation->x, allocation->y, allocation->x, allocation->y,
allocation->width, allocation->height); 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, gdk_window_move_resize(GTK_FORM(widget)->bin_window,
0, 0, 0, 0,
allocation->width, allocation->height); allocation->width, allocation->height);

View File

@ -763,11 +763,7 @@ property_event(GtkWidget *widget,
{ {
if (event->type == GDK_PROPERTY_NOTIFY if (event->type == GDK_PROPERTY_NOTIFY
&& event->state == (int)GDK_PROPERTY_NEW_VALUE && event->state == (int)GDK_PROPERTY_NEW_VALUE
# if GTK_CHECK_VERSION(3,0,0)
&& GDK_WINDOW_XID(event->window) == commWindow && GDK_WINDOW_XID(event->window) == commWindow
# else
&& GDK_WINDOW_XWINDOW(event->window) == commWindow
# endif
&& GET_X_ATOM(event->atom) == commProperty) && GET_X_ATOM(event->atom) == commProperty)
{ {
XEvent xev; XEvent xev;
@ -777,12 +773,8 @@ property_event(GtkWidget *widget,
xev.xproperty.atom = commProperty; xev.xproperty.atom = commProperty;
xev.xproperty.window = commWindow; xev.xproperty.window = commWindow;
xev.xproperty.state = PropertyNewValue; xev.xproperty.state = PropertyNewValue;
# if GTK_CHECK_VERSION(3,0,0)
serverEventProc(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)), serverEventProc(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)),
&xev, 0); &xev, 0);
# else
serverEventProc(GDK_WINDOW_XDISPLAY(widget->window), &xev, 0);
# endif
} }
return FALSE; return FALSE;
} }
@ -2653,17 +2645,11 @@ setup_save_yourself(void)
/* Fall back to old method */ /* Fall back to old method */
/* first get the existing value */ /* first get the existing value */
# if GTK_CHECK_VERSION(3,0,0)
GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);
if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win),
GDK_WINDOW_XID(mainwin_win), GDK_WINDOW_XID(mainwin_win),
&existing_atoms, &count)) &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 *new_atoms;
Atom save_yourself_xatom; Atom save_yourself_xatom;
@ -2685,13 +2671,8 @@ setup_save_yourself(void)
{ {
memcpy(new_atoms, existing_atoms, count * sizeof(Atom)); memcpy(new_atoms, existing_atoms, count * sizeof(Atom));
new_atoms[count] = save_yourself_xatom; new_atoms[count] = save_yourself_xatom;
# if GTK_CHECK_VERSION(3,0,0)
XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win),
GDK_WINDOW_XID(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); new_atoms, count + 1);
vim_free(new_atoms); vim_free(new_atoms);
} }
@ -2736,13 +2717,8 @@ global_event_filter(GdkXEvent *xev,
* know we are done saving ourselves. We don't want to be * know we are done saving ourselves. We don't want to be
* restarted, thus set argv to NULL. * restarted, thus set argv to NULL.
*/ */
# if GTK_CHECK_VERSION(3,0,0)
XSetCommand(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)), XSetCommand(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)),
GDK_WINDOW_XID(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); NULL, 0);
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
} }
@ -2776,18 +2752,12 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
#undef magick #undef magick
# undef static # undef static
#if GTK_CHECK_VERSION(3,0,0)
GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);
#endif
/* When started with "--echo-wid" argument, write window ID on stdout. */ /* When started with "--echo-wid" argument, write window ID on stdout. */
if (echo_wid_arg) if (echo_wid_arg)
{ {
#if GTK_CHECK_VERSION(3,0,0)
printf("WID: %ld\n", (long)GDK_WINDOW_XID(mainwin_win)); 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); fflush(stdout);
} }
@ -2824,17 +2794,10 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
if (serverName == NULL && serverDelayedStartName != NULL) if (serverName == NULL && serverDelayedStartName != NULL)
{ {
/* This is a :gui command in a plain vim with no previous server */ /* 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); commWindow = GDK_WINDOW_XID(mainwin_win);
(void)serverRegisterName(GDK_WINDOW_XDISPLAY(mainwin_win), (void)serverRegisterName(GDK_WINDOW_XDISPLAY(mainwin_win),
serverDelayedStartName); serverDelayedStartName);
# else
commWindow = GDK_WINDOW_XWINDOW(gui.mainwin->window);
(void)serverRegisterName(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
serverDelayedStartName);
# endif
} }
else else
{ {
@ -2843,13 +2806,8 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
* have to change the "server" registration to that of the main window * have to change the "server" registration to that of the main window
* If we have not registered a name yet, remember the 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), serverChangeRegisteredWindow(GDK_WINDOW_XDISPLAY(mainwin_win),
GDK_WINDOW_XID(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); gtk_widget_add_events(gui.mainwin, GDK_PROPERTY_CHANGE_MASK);
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
@ -2945,14 +2903,9 @@ mainwin_screen_changed_cb(GtkWidget *widget,
gui.blank_pointer = create_blank_pointer(); gui.blank_pointer = create_blank_pointer();
#if GTK_CHECK_VERSION(3,0,0)
if (gui.pointer_hidden && gtk_widget_get_window(gui.drawarea) != NULL) if (gui.pointer_hidden && gtk_widget_get_window(gui.drawarea) != NULL)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer); 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 * Create a new PangoContext for this screen, and initialize it
@ -3002,11 +2955,7 @@ drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED)
gui.blank_pointer = create_blank_pointer(); gui.blank_pointer = create_blank_pointer();
if (gui.pointer_hidden) if (gui.pointer_hidden)
#if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(widget), gui.blank_pointer); 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 */ /* get the actual size of the scrollbars, if they are realized */
sbar = firstwin->w_scrollbars[SBAR_LEFT].id; sbar = firstwin->w_scrollbars[SBAR_LEFT].id;
@ -4923,15 +4872,9 @@ force_shell_resize_idle(gpointer data)
int int
gui_mch_maximized(void) gui_mch_maximized(void)
{ {
#if GTK_CHECK_VERSION(3,0,0)
return (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL return (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL
&& (gdk_window_get_state(gtk_widget_get_window(gui.mainwin)) && (gdk_window_get_state(gtk_widget_get_window(gui.mainwin))
& GDK_WINDOW_STATE_MAXIMIZED)); & 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
} }
/* /*
@ -6051,11 +5994,7 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
cairo_t *cr; cairo_t *cr;
#endif #endif
#if GTK_CHECK_VERSION(3,0,0)
if (gui.text_context == NULL || gtk_widget_get_window(gui.drawarea) == NULL) 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; return len;
if (output_conv.vc_type != CONV_NONE) if (output_conv.vc_type != CONV_NONE)
@ -6366,19 +6305,10 @@ gui_mch_haskey(char_u *name)
int int
gui_get_x11_windis(Window *win, Display **dis) 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) 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)); *dis = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin));
*win = GDK_WINDOW_XID(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; return OK;
} }
@ -6394,13 +6324,8 @@ gui_get_x11_windis(Window *win, Display **dis)
Display * Display *
gui_mch_get_display(void) gui_mch_get_display(void)
{ {
#if GTK_CHECK_VERSION(3,0,0)
if (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL) if (gui.mainwin != NULL && gtk_widget_get_window(gui.mainwin) != NULL)
return GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)); 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 else
return NULL; return NULL;
} }
@ -6555,11 +6480,7 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
cairo_t *cr; cairo_t *cr;
#endif #endif
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) == NULL) if (gtk_widget_get_window(gui.drawarea) == NULL)
#else
if (gui.drawarea->window == NULL)
#endif
return; return;
#if GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0)
@ -6600,11 +6521,7 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
void void
gui_mch_draw_part_cursor(int w, int h, guicolor_T color) 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) if (gtk_widget_get_window(gui.drawarea) == NULL)
#else
if (gui.drawarea->window == NULL)
#endif
return; return;
gui_mch_set_fg_color(color); gui_mch_set_fg_color(color);
@ -6880,18 +6797,15 @@ gui_gtk_window_clear(GdkWindow *win)
if (!gui.by_signal) if (!gui.by_signal)
gdk_window_invalidate_rect(win, &rect, FALSE); gdk_window_invalidate_rect(win, &rect, FALSE);
} }
#else
# define gui_gtk_window_clear(win) gdk_window_clear(win)
#endif #endif
void void
gui_mch_clear_all(void) gui_mch_clear_all(void)
{ {
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) != NULL) if (gtk_widget_get_window(gui.drawarea) != NULL)
gui_gtk_window_clear(gtk_widget_get_window(gui.drawarea)); 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) #if !GTK_CHECK_VERSION(3,0,0)
@ -7084,12 +6998,8 @@ clip_mch_request_selection(VimClipboard *cbd)
} }
/* Final fallback position - use the X CUT_BUFFER0 store */ /* 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)), yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)),
cbd); cbd);
#else
yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gui.mainwin->window), cbd);
#endif
} }
/* /*
@ -7269,15 +7179,9 @@ gui_mch_setmouse(int x, int y)
/* Sorry for the Xlib call, but we can't avoid it, since there is no /* 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 * internal GDK mechanism present to accomplish this. (and for good
* reason...) */ * reason...) */
#if GTK_CHECK_VERSION(3,0,0)
XWarpPointer(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.drawarea)), XWarpPointer(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.drawarea)),
(Window)0, GDK_WINDOW_XID(gtk_widget_get_window(gui.drawarea)), (Window)0, GDK_WINDOW_XID(gtk_widget_get_window(gui.drawarea)),
0, 0, 0U, 0U, x, y); 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
} }
@ -7298,26 +7202,16 @@ gui_mch_mousehide(int hide)
if (gui.pointer_hidden != hide) if (gui.pointer_hidden != hide)
{ {
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) if (gtk_widget_get_window(gui.drawarea) && gui.blank_pointer != NULL)
#else
if (gui.drawarea->window && gui.blank_pointer != NULL)
#endif
{ {
if (hide) if (hide)
#if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer); gui.blank_pointer);
#else
gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer);
#endif
else else
#ifdef FEAT_MOUSESHAPE #ifdef FEAT_MOUSESHAPE
mch_set_mouse_shape(last_shape); 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 #else
gdk_window_set_cursor(gui.drawarea->window, NULL); gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), NULL);
#endif #endif
} }
} }
@ -7354,20 +7248,12 @@ mch_set_mouse_shape(int shape)
int id; int id;
GdkCursor *c; GdkCursor *c;
# if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_window(gui.drawarea) == NULL) if (gtk_widget_get_window(gui.drawarea) == NULL)
# else
if (gui.drawarea->window == NULL)
# endif
return; return;
if (shape == MSHAPE_HIDE || gui.pointer_hidden) if (shape == MSHAPE_HIDE || gui.pointer_hidden)
# if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea),
gui.blank_pointer); gui.blank_pointer);
# else
gdk_window_set_cursor(gui.drawarea->window, gui.blank_pointer);
# endif
else else
{ {
if (shape >= MSHAPE_NUMBERED) if (shape >= MSHAPE_NUMBERED)
@ -7384,11 +7270,7 @@ mch_set_mouse_shape(int shape)
return; return;
c = gdk_cursor_new_for_display( c = gdk_cursor_new_for_display(
gtk_widget_get_display(gui.drawarea), (GdkCursorType)id); 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); 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) # if GTK_CHECK_VERSION(3,0,0)
g_object_unref(G_OBJECT(c)); g_object_unref(G_OBJECT(c));
# else # else
@ -7420,12 +7302,8 @@ gui_mch_drawsign(int row, int col, int typenr)
sign = (GdkPixbuf *)sign_get_image(typenr); sign = (GdkPixbuf *)sign_get_image(typenr);
# if GTK_CHECK_VERSION(3,0,0)
if (sign != NULL && gui.drawarea != NULL if (sign != NULL && gui.drawarea != NULL
&& gtk_widget_get_window(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 width;
int height; int height;

View File

@ -4959,11 +4959,7 @@ im_preedit_window_set_position(void)
gui_gtk_get_screen_geom_of_win(gui.drawarea, gui_gtk_get_screen_geom_of_win(gui.drawarea,
&screen_x, &screen_y, &screen_width, &screen_height); &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); 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); gtk_window_get_size(GTK_WINDOW(preedit_window), &width, &height);
x = x + FILL_X(gui.col); x = x + FILL_X(gui.col);
y = y + FILL_Y(gui.row); y = y + FILL_Y(gui.row);
@ -5565,11 +5561,7 @@ xim_init(void)
#endif #endif
g_return_if_fail(gui.drawarea != NULL); 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); 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(); xic = gtk_im_multicontext_new();
g_object_ref(xic); g_object_ref(xic);
@ -5583,11 +5575,7 @@ xim_init(void)
g_signal_connect(G_OBJECT(xic), "preedit_end", g_signal_connect(G_OBJECT(xic), "preedit_end",
G_CALLBACK(&im_preedit_end_cb), NULL); 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)); 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 void
@ -5686,17 +5674,9 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
GdkEventKey *event; GdkEventKey *event;
event = (GdkEventKey *)gdk_event_new(GDK_KEY_PRESS); event = (GdkEventKey *)gdk_event_new(GDK_KEY_PRESS);
# if GTK_CHECK_VERSION(3,0,0)
g_object_ref(gtk_widget_get_window(gui.drawarea)); g_object_ref(gtk_widget_get_window(gui.drawarea));
/* unreffed by gdk_event_free() */ /* 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); event->window = gtk_widget_get_window(gui.drawarea);
# else
event->window = gui.drawarea->window;
# endif
event->send_event = TRUE; event->send_event = TRUE;
event->time = GDK_CURRENT_TIME; event->time = GDK_CURRENT_TIME;
event->state = state; event->state = state;

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
368,
/**/ /**/
367, 367,
/**/ /**/

View File

@ -1241,7 +1241,7 @@ typedef struct {
#define MIN_SWAP_PAGE_SIZE 1048 #define MIN_SWAP_PAGE_SIZE 1048
#define MAX_SWAP_PAGE_SIZE 50000 #define MAX_SWAP_PAGE_SIZE 50000
/* Special values for current_SID. */ /* Special values for current_sctx.sc_sid. */
#define SID_MODELINE -1 /* when using a modeline */ #define SID_MODELINE -1 /* when using a modeline */
#define SID_CMDARG -2 /* for "--cmd" argument */ #define SID_CMDARG -2 /* for "--cmd" argument */
#define SID_CARG -3 /* for "-c" argument */ #define SID_CARG -3 /* for "-c" argument */
@ -2329,6 +2329,12 @@ typedef enum {
# endif # endif
#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 #ifndef FEAT_NETBEANS_INTG
# undef NBDEBUG # undef NBDEBUG
#endif #endif