[virt-tools-list] [PATCH virt-viewer] Remove gtk_window_present() call
Marc-André Lureau
marcandre.lureau at gmail.com
Wed Mar 20 18:46:40 UTC 2013
Hi
On Wed, Mar 20, 2013 at 7:39 PM, Daniel P. Berrange <berrange at redhat.com> wrote:
> On Wed, Mar 20, 2013 at 07:05:12PM +0100, Marc-André Lureau wrote:
>> gtk_window_present() may forcefully call gdk_window_show(), which will
>> call ShowWindow(). Although gdk call is not supposed to move the
>> window if it's already visible, it does restore the window position on
>> Vista+. For example, a snapped window will be moved back to its
>> previous position.
>>
>> Gtk+ ShowWindow() is currently using SW_SHOWNOACTIVATE, it should
>> probably use SW_SHOWNA instead, but that didn't help anyway for a
>> snapped window.
>>
>> Since virt_viewer_window_show() already ensure the window is visible,
>> I am not sure why gtk_window_present() is there in the first place, so
>> just remove it.
>
> Well virt_viewer_window_show() merely calls gtk_window_show()
> which just unhides the window, but does not guarantee that the
> user can actually see it. Per the docs gtk_window_present()
> does more, ensuring the window is actually visible to the user
>
> " Presents a window to the user. This may mean raising the
> window in the stacking order, deiconifying it, moving it
> to the current desktop, and/or giving it the keyboard focus,
> possibly dependent on the user's platform, window manager,
> and preferences. "
>
> so I don't think we should be removing this
But I am not sure why this is desirable. If I enable a monitor, I
don't necessarily want it to be front and have the focus immediately.
Only use case I can think of is to use the display menu to bring a
window to front. However, that's not supported since it's a
check-item, it will disable it instead. Showing a hidden window does
bring it to front already, afaik (to be verified)
>
>> https://bugzilla.redhat.com/show_bug.cgi?id=912713
>
> Looking the problem description, I'm not convinced that the
> gtk_window_present() is the root cause of the problem, but
> rather just something that highlights a problem that exists
> elsewhere
I think I understand the root cause, and I wished my somewhat lengthy
description would be enough, I don't know what to add there. I
actually spent at least an hour playing with ShowWindow() calls in gdk
win32 and looking for solutions, I don't see anything right now, and I
don't think it's worth spending more time when the call is already
arguable.
--
Marc-André Lureau
More information about the virt-tools-list
mailing list