Re: Why is it impossible to move a window programmatically in GTK+ (C/C++)

2018-05-30 Thread Emmanuele Bassi
On 30 May 2018 at 18:33, Tarie Nosworthy via gtk-app-devel-list <
gtk-app-devel-list@gnome.org> wrote:

> I am writing an app in GTK+, and I wanted to center a splash screen.
> Coming from a Windows background, where SetWindowPos does the job, I found
> out the X Window Manager always ignores requests to move a window,
> therefore eventually denying any attempt to manipulative the position of a
> window.  I can resize it, even dynamically, and I can move it with the
> mouse, but never in code.  Why?  It seems very strange that GTK would just
> disallow it.  You have gravity properties, but not matter what gravity I
> set, the position NEVER changes.  Why have the APIs if GTK is free to
> ignore them.  I'm baffled by it.
>

Hi;

some of the GtkWindow API work on a "best effort" basis; on X11, window
managers are wholly in charge of managing windows according to their own
rules and constraints, and they can ignore the hints set by an application.
Additionally, you can have other client apps that manage the window for you
— see, for instance, Devil's Pie[0], which gives you the ability to match
windows and execute scripts for them.

Additionally, if there is no window manager present — for instance, because
you're running a single window kiosk-style appliance — some functionality
like fullscreen won't simply be available, as it's part of a IPC protocol
with the window manager.

If you want, you can manage the window yourself — use a GTK_WINDOW_POPUP as
the window type, and then use your own decorations; you'll be in charge of
reimplementing window repositioning and resizing, but you're guaranteed
that the window manager won't interfere with your application.

As a side note: when using Wayland as a display server, you won't really be
able to deal with global coordinates and positioning, given that every
client surface operates in isolation.

Ciao,
 Emmanuele.

[0]: http://www.nongnu.org/devilspie2/


-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Why is it impossible to move a window programmatically in GTK+ (C/C++)

2018-05-30 Thread Liam R E Quin
On Wed, 2018-05-30 at 13:33 -0400, Tarie Nosworthy via gtk-app-devel-
list wrote:
> I am writing an app in GTK+, and I wanted to center a splash screen.

Note, users get irritated by splash screens they can't move.

You *can* make a window that's centered and immovable, e.g. gimp does
it, so you could look at that, but if it's visible for more than a
second or two it's incredibly annoying in a world where people tend to
run lots of applications at the same time.

Liam

-- 
Liam Quin - web slave for https://www.fromoldbooks.org/
with fabulous vintage art and fascinating texts to read.
Click here to have the slave beaten.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list