mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.0.1084: GTK build has compiler warnings
Problem: GTK build has compiler warnings. (Christian Brabandt) Solution: Get screen size with a different function. (Ken Takata, Yasuhiro Matsumoto)
This commit is contained in:
@@ -1177,23 +1177,15 @@ drawBalloon(BalloonEval *beval)
|
||||
int x_offset = EVAL_OFFSET_X;
|
||||
int y_offset = EVAL_OFFSET_Y;
|
||||
PangoLayout *layout;
|
||||
# if GTK_CHECK_VERSION(3,22,2)
|
||||
GdkRectangle rect;
|
||||
GdkMonitor * const mon = gdk_display_get_monitor_at_window(
|
||||
gtk_widget_get_display(beval->balloonShell),
|
||||
gtk_widget_get_window(beval->balloonShell));
|
||||
gdk_monitor_get_geometry(mon, &rect);
|
||||
|
||||
screen_w = rect.width;
|
||||
screen_h = rect.height;
|
||||
# else
|
||||
# if !GTK_CHECK_VERSION(3,22,2)
|
||||
GdkScreen *screen;
|
||||
|
||||
screen = gtk_widget_get_screen(beval->target);
|
||||
gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
|
||||
screen_w = gdk_screen_get_width(screen);
|
||||
screen_h = gdk_screen_get_height(screen);
|
||||
# endif
|
||||
gui_gtk_get_screen_size_of_win(beval->balloonShell,
|
||||
&screen_w, &screen_h);
|
||||
# if !GTK_CHECK_VERSION(3,0,0)
|
||||
gtk_widget_ensure_style(beval->balloonShell);
|
||||
gtk_widget_ensure_style(beval->balloonLabel);
|
||||
|
@@ -4941,6 +4941,29 @@ gui_mch_set_shellsize(int width, int height,
|
||||
gui_mch_update();
|
||||
}
|
||||
|
||||
void
|
||||
gui_gtk_get_screen_size_of_win(GtkWidget *win, int *width, int *height)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,22,0)
|
||||
GdkDisplay *dpy = gtk_widget_get_display(win);
|
||||
GdkWindow *win = gtk_widget_get_window(win);
|
||||
GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
|
||||
GdkRectangle geometry;
|
||||
|
||||
gdk_monitor_get_geometry(monitor, &geometry);
|
||||
*width = geometry.width;
|
||||
*height = geometry.height;
|
||||
#else
|
||||
GdkScreen* screen;
|
||||
|
||||
if (win != NULL && gtk_widget_has_screen(win))
|
||||
screen = gtk_widget_get_screen(win);
|
||||
else
|
||||
screen = gdk_screen_get_default();
|
||||
*width = gdk_screen_get_width(screen);
|
||||
*height = gdk_screen_get_height(screen);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* The screen size is used to make sure the initial window doesn't get bigger
|
||||
@@ -4950,30 +4973,11 @@ gui_mch_set_shellsize(int width, int height,
|
||||
void
|
||||
gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,22,2)
|
||||
GdkRectangle rect;
|
||||
GdkMonitor * const mon = gdk_display_get_monitor_at_window(
|
||||
gtk_widget_get_display(gui.mainwin),
|
||||
gtk_widget_get_window(gui.mainwin));
|
||||
gdk_monitor_get_geometry(mon, &rect);
|
||||
gui_gtk_get_screen_size_of_win(gui.mainwin, screen_w, screen_h);
|
||||
|
||||
*screen_w = rect.width;
|
||||
/* Subtract 'guiheadroom' from the height to allow some room for the
|
||||
* window manager (task list and window title bar). */
|
||||
*screen_h = rect.height - p_ghr;
|
||||
#else
|
||||
GdkScreen* screen;
|
||||
|
||||
if (gui.mainwin != NULL && gtk_widget_has_screen(gui.mainwin))
|
||||
screen = gtk_widget_get_screen(gui.mainwin);
|
||||
else
|
||||
screen = gdk_screen_get_default();
|
||||
|
||||
*screen_w = gdk_screen_get_width(screen);
|
||||
/* Subtract 'guiheadroom' from the height to allow some room for the
|
||||
* window manager (task list and window title bar). */
|
||||
*screen_h = gdk_screen_get_height(screen) - p_ghr;
|
||||
#endif
|
||||
*screen_h -= p_ghr;
|
||||
|
||||
/*
|
||||
* FIXME: dirty trick: Because the gui_get_base_height() doesn't include
|
||||
|
@@ -4871,8 +4871,7 @@ im_preedit_window_set_position(void)
|
||||
if (preedit_window == NULL)
|
||||
return;
|
||||
|
||||
sw = gdk_screen_get_width(gtk_widget_get_screen(preedit_window));
|
||||
sh = gdk_screen_get_height(gtk_widget_get_screen(preedit_window));
|
||||
gui_gtk_get_screen_size_of_win(preedit_window, &sw, &sh);
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
|
||||
#else
|
||||
|
@@ -25,6 +25,7 @@ int gui_mch_maximized(void);
|
||||
void gui_mch_unmaximize(void);
|
||||
void gui_mch_newfont(void);
|
||||
void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction);
|
||||
void gui_gtk_get_screen_size_of_win(GtkWidget *win, int *width, int *height);
|
||||
void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h);
|
||||
void gui_mch_settitle(char_u *title, char_u *icon);
|
||||
void gui_mch_enable_menu(int showit);
|
||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1084,
|
||||
/**/
|
||||
1083,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user