Re: GdkScreen size-changed and gdk_monitor_get_workarea problem
Dear Bastien, thanks for the reply. I will attach a sample next time. My App runs with the X11 backend. I was able to resolve the issue yesterday, and found that it was not directly a Problem of GTK+. The problem is, that the window manager computes the workarea asynchronosly, presumably its handled in a g_add_idle callback. When I tried to use get_geometry instead of get_workarea I was always getting the correct values, but I specifically needed the workarea so that was not helping. My solution was then to register a filter function with gdk_window_add_filter which listens for _NET_WORKAREA property changes and then queue a g_add_idle callback which handles the change. I tested the behavior with mutter and metacity and both had the same problem. I am not sure if this is by design, or a bug. However, I would like to suggest that we add a small note to the documentation of the monitor-changed signal and the size-change signal, stating that values reported by gdk_monitor_get_workarea might arrive delayed. Alternatively, fixing mutter and metacity would be my preferred solution but would probably be more work and I have not the necessary knowledge about mutter code to fix this myself. Best Regards Sebastian On 07/11/18 20:08, Bastien Nocera wrote: On Tue, 2018-11-06 at 21:35 +0100, Sebastian Geiger (Lanoxx) wrote: Hi Gtk developers, I am experiencing a wired issue and I am wondering if I am using the API in a wrong way of if there is a problem with Gtk. On Wayland or X11? gdk_display_get_monitor_at_point and then gdk_monitor_get_workarea. IIRC, the latter function isn't implemented in Wayland. In the future, it would also probably be best if you could attach or copy/paste a minimal test case, so folks on the mailing-list can try your code, and see either if there are errors in the code, or those are really bugs (or missing functionality). Cheers ___ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: GdkScreen size-changed and gdk_monitor_get_workarea problem
On Thu, 2018-11-08 at 12:34 +0100, Sebastian Geiger (Lanoxx) wrote: > Dear Bastien, > > thanks for the reply. I will attach a sample next time. > > My App runs with the X11 backend. > > I was able to resolve the issue yesterday, and found that it was not > directly a Problem of GTK+. > > The problem is, that the window manager computes the workarea > asynchronosly, presumably its handled in a g_add_idle callback. > When I tried to use get_geometry instead of get_workarea I was > always > getting the correct values, but I specifically needed the workarea > so > that was not helping. > > My solution was then to register a filter function with > gdk_window_add_filter which listens for _NET_WORKAREA property > changes > and then queue a g_add_idle callback which handles the change. > > I tested the behavior with mutter and metacity and both had the same > problem. > > I am not sure if this is by design, or a bug. However, I would like > to > suggest that we add a small note to the documentation of the > monitor-changed signal and the size-change signal, stating that > values reported by gdk_monitor_get_workarea might arrive delayed. > Alternatively, fixing mutter and metacity would be my preferred > solution > but would probably be more work and I have not the necessary > knowledge > about mutter code to fix this myself. I'd start with filing a bug against mutter (I'm not sure metacity is still maintained), and see whether the GDK API documentation should be amended after discussing it there. Unless you're writing a panel of sorts, I don't think end-user applications should use this API in any case, with the window manager taking care of the window layout. Cheers ___ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: GdkScreen size-changed and gdk_monitor_get_workarea problem
On Thu, Nov 8, 2018 at 12:35 PM Sebastian Geiger (Lanoxx) wrote: > > I was able to resolve the issue yesterday, and found that it was not > directly a Problem of GTK+. To some extent it is, I don't think its API currently allows what you are trying to do. On X11, the WM is a client like your app as far as screen changes are concerned. It will update the _NET_WORKAREA property in response to the size change, but I don't see how it would be possible to ensure that the property is written before the server notifies other clients about the size change. But let's assume that this was possible and fixed. It would still be possible for your app to get the wrong work area, because the area can change without a change in screen size (for example a dock or panel that is shown or removed). So if this is something GTK+ wants to support, then I think the best option would be to emit change notifications for GdkMonitor:workarea. Cheers, Florian ___ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list