[Github-comments] [geany/geany-plugins] commander: hidpi scaling? (#1044)
Colomban Wendling
notifications at xxxxx
Fri Dec 11 19:26:56 UTC 2020
Currently it's hard-coded to a 500×200 default size, and if resized the new size doesn't survives a Geany restart. There's 3 things I could do:
1. adapt that default size to the display scale (which is *not* the DPI)
2. adapt to the height of a line, but that's tricky to compute
3. allow configuration (or at least, restoring) default size
First option seems easy enough, and see below for a test patch.
Option 2 is probably best, but is clearly the most complicated of all.
Option 3 would be fairly easy, but I'm not sure if it's really practical.
Here's the patch for solution 1 (untested, as I don't have a HiDPI monitor at hand). Note that this requires a Geany GTK3 build with GTK >= 3.10 (fairly old by now) *and* you having set the scaling factor rather than just raised the DPI through the roof.
```diff
diff --git a/commander/src/commander-plugin.c b/commander/src/commander-plugin.c
index 9f8d0718..a138ec41 100644
--- a/commander/src/commander-plugin.c
+++ b/commander/src/commander-plugin.c
@@ -654,11 +654,16 @@ create_panel (void)
GtkWidget *scroll;
GtkTreeViewColumn *col;
GtkCellRenderer *cell;
+ gint scale = 1;
+
+#if GTK_CHECK_VERSION (3, 10)
+ scale = gtk_widget_get_scale_factor (geany_data->main_widgets->window);
+#endif
plugin_data.panel = g_object_new (GTK_TYPE_WINDOW,
"decorated", FALSE,
- "default-width", 500,
- "default-height", 200,
+ "default-width", 500 * scale,
+ "default-height", 200 * scale,
"transient-for", geany_data->main_widgets->window,
"window-position", GTK_WIN_POS_CENTER_ON_PARENT,
"type-hint", GDK_WINDOW_TYPE_HINT_DIALOG,
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1044#issuecomment-743383188
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20201211/d7730d22/attachment.htm>
More information about the Github-comments
mailing list