Commit 36cf0791 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

Remove usage of the GDK_SCALE variable

* src/gtkutil.c (xg_get_gdk_scale): Remove.
(xg_get_default_scrollbar_height)
(xg_get_default_scrollbar_width): Pass in a frame to check for
scaling.
(xg_frame_set_char_size): Use the API for querying scale
instead of looking at the GDK_SCALE variable.
(xg_get_default_scrollbar_width): Ditto.
(xg_get_default_scrollbar_height): Ditto.
(xg_update_scrollbar_pos): Ditto.

* src/xfns.c (x_set_scroll_bar_default_height): Pass in the
frame to get the width.
parent 4198b4d9
...@@ -845,21 +845,6 @@ xg_set_geometry (struct frame *f) ...@@ -845,21 +845,6 @@ xg_set_geometry (struct frame *f)
} }
} }
static int
xg_get_gdk_scale (void)
{
const char *sscale = getenv ("GDK_SCALE");
if (sscale)
{
long scale = atol (sscale);
if (0 < scale)
return min (scale, INT_MAX);
}
return 1;
}
/* Function to handle resize of our frame. As we have a Gtk+ tool bar /* Function to handle resize of our frame. As we have a Gtk+ tool bar
and a Gtk+ menu bar, we get resize events for the edit part of the and a Gtk+ menu bar, we get resize events for the edit part of the
frame only. We let Gtk+ deal with the Gtk+ parts. frame only. We let Gtk+ deal with the Gtk+ parts.
...@@ -921,12 +906,8 @@ xg_frame_set_char_size (struct frame *f, int width, int height) ...@@ -921,12 +906,8 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
/* Do this before resize, as we don't know yet if we will be resized. */ /* Do this before resize, as we don't know yet if we will be resized. */
x_clear_under_internal_border (f); x_clear_under_internal_border (f);
if (FRAME_VISIBLE_P (f)) totalheight /= xg_get_scale (f);
{ totalwidth /= xg_get_scale (f);
int scale = xg_get_gdk_scale ();
totalheight /= scale;
totalwidth /= scale;
}
x_wm_set_size_hint (f, 0, 0); x_wm_set_size_hint (f, 0, 0);
...@@ -1352,7 +1333,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) ...@@ -1352,7 +1333,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
int min_rows = 0, min_cols = 0; int min_rows = 0, min_cols = 0;
int win_gravity = f->win_gravity; int win_gravity = f->win_gravity;
Lisp_Object fs_state, frame; Lisp_Object fs_state, frame;
int scale = xg_get_gdk_scale (); int scale = xg_get_scale (f);
/* Don't set size hints during initialization; that apparently leads /* Don't set size hints during initialization; that apparently leads
to a race condition. See the thread at to a race condition. See the thread at
...@@ -3668,16 +3649,16 @@ update_theme_scrollbar_height (void) ...@@ -3668,16 +3649,16 @@ update_theme_scrollbar_height (void)
} }
int int
xg_get_default_scrollbar_width (void) xg_get_default_scrollbar_width (struct frame *f)
{ {
return scroll_bar_width_for_theme * xg_get_gdk_scale (); return scroll_bar_width_for_theme * xg_get_scale (f);
} }
int int
xg_get_default_scrollbar_height (void) xg_get_default_scrollbar_height (struct frame *f)
{ {
/* Apparently there's no default height for themes. */ /* Apparently there's no default height for themes. */
return scroll_bar_width_for_theme * xg_get_gdk_scale (); return scroll_bar_width_for_theme * xg_get_scale (f);
} }
/* Return the scrollbar id for X Window WID on display DPY. /* Return the scrollbar id for X Window WID on display DPY.
...@@ -3867,7 +3848,7 @@ xg_update_scrollbar_pos (struct frame *f, ...@@ -3867,7 +3848,7 @@ xg_update_scrollbar_pos (struct frame *f,
GtkWidget *wfixed = f->output_data.x->edit_widget; GtkWidget *wfixed = f->output_data.x->edit_widget;
GtkWidget *wparent = gtk_widget_get_parent (wscroll); GtkWidget *wparent = gtk_widget_get_parent (wscroll);
gint msl; gint msl;
int scale = xg_get_gdk_scale (); int scale = xg_get_scale (f);
top /= scale; top /= scale;
left /= scale; left /= scale;
......
...@@ -143,8 +143,8 @@ extern void xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar, ...@@ -143,8 +143,8 @@ extern void xg_set_toolkit_horizontal_scroll_bar_thumb (struct scroll_bar *bar,
int position, int position,
int whole); int whole);
extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent *); extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent *);
extern int xg_get_default_scrollbar_width (void); extern int xg_get_default_scrollbar_width (struct frame *f);
extern int xg_get_default_scrollbar_height (void); extern int xg_get_default_scrollbar_height (struct frame *f);
extern void update_frame_tool_bar (struct frame *f); extern void update_frame_tool_bar (struct frame *f);
extern void free_frame_tool_bar (struct frame *f); extern void free_frame_tool_bar (struct frame *f);
......
...@@ -2062,7 +2062,7 @@ x_set_scroll_bar_default_width (struct frame *f) ...@@ -2062,7 +2062,7 @@ x_set_scroll_bar_default_width (struct frame *f)
int unit = FRAME_COLUMN_WIDTH (f); int unit = FRAME_COLUMN_WIDTH (f);
#ifdef USE_TOOLKIT_SCROLL_BARS #ifdef USE_TOOLKIT_SCROLL_BARS
#ifdef USE_GTK #ifdef USE_GTK
int minw = xg_get_default_scrollbar_width (); int minw = xg_get_default_scrollbar_width (f);
#else #else
int minw = 16; int minw = 16;
#endif #endif
...@@ -2083,7 +2083,7 @@ x_set_scroll_bar_default_height (struct frame *f) ...@@ -2083,7 +2083,7 @@ x_set_scroll_bar_default_height (struct frame *f)
int height = FRAME_LINE_HEIGHT (f); int height = FRAME_LINE_HEIGHT (f);
#ifdef USE_TOOLKIT_SCROLL_BARS #ifdef USE_TOOLKIT_SCROLL_BARS
#ifdef USE_GTK #ifdef USE_GTK
int min_height = xg_get_default_scrollbar_height (); int min_height = xg_get_default_scrollbar_height (f);
#else #else
int min_height = 16; int min_height = 16;
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment