5.40LTS - Moving a window shows it at 0,0 coordinates

Linux specific forum
Niffo
Enthusiast
Enthusiast
Posts: 500
Joined: Tue Jan 31, 2006 9:43 am
Location: France

5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Niffo »

Moving a window shows it at 0,0 coordinates half a second :

Code: Select all

OpenWindow(0, 100, 100, 300, 200, "gtk api test")
ResizeWindow(0, 150, 150, #PB_Ignore, #PB_Ignore)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
(seen on Debian 8-64 / Gnome with PB 5.40LTS 64 bits)
Last edited by Niffo on Thu Oct 22, 2015 5:38 pm, edited 2 times in total.
Niffo
pwd
User
User
Posts: 60
Joined: Thu Sep 06, 2012 9:39 am

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by pwd »

Not a bug, IMHO.

Code: Select all

OpenWindow(0, 100, 100, 300, 200, "gtk api test", #PB_Window_Invisible)
ResizeWindow(0, 150, 150, #PB_Ignore, #PB_Ignore)
HideWindow(0, #False)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow


To be sure there is no bug, try this:

Code: Select all

If OpenWindow(0, 0, 0, 230, 90, "...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

ButtonGadget  (1, 10, 10, 200, 20, "Click me")

Repeat
  Event = WaitWindowEvent()
  If Event = #PB_Event_Gadget
    ResizeWindow(0, Random(500, 100), Random(500, 100), #PB_Ignore, #PB_Ignore)
  EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Fred »

I don't think it's a bug as you displayed it before performing the move, so yes it can be shown until the move is handled by the window manager.
Niffo
Enthusiast
Enthusiast
Posts: 500
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Niffo »

Sorry my sample code was not very complete because I wanted to simplify it at maximum.
The same occurs with a hidden Window, see the snippet bellow :

Code: Select all

OpenWindow(0, 100, 100, 300, 200, "gtk api test", #PB_Window_Invisible)
ResizeWindow(0, 150, 150, #PB_Ignore, #PB_Ignore)
HideWindow(0, #False)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Obviously this problem does not occur with gtk2 nor with others OSs.
Niffo
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Fred »

I see. The problem is with GTK3, which can't move an hidden window, so it's done when unhiding it. So sometimes you can see the refresh

http://www.purebasic.fr/english/viewtop ... 23&t=62753
Niffo
Enthusiast
Enthusiast
Posts: 500
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Niffo »

Noted, thank you.
Niffo
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by uwekel »

Fred wrote:I see. The problem is with GTK3, which can't move an hidden window, so it's done when unhiding it. So sometimes you can see the refresh
This is the main reason why i stick on 5.31.
Will you fix it?
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Fred »

The problem is we can't fix it, it seems to be a GTK3 oddity as it works properly with GTK2.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Little John »

uwekel wrote:
Fred wrote:I see. The problem is with GTK3, which can't move an hidden window, so it's done when unhiding it. So sometimes you can see the refresh
This is the main reason why i stick on 5.31.
I think with PB 5.40, we can also use GTK 2 as subsystem. Or is this wrong?
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by uwekel »

I don't know exactly how you coded this, but i guess you are calling the gtk_widget_show_all() method even if the #PB_Window_Invisible flag is set. I tried to reproduce this behaviour with python and got this snippet:

Code: Select all

from gi.repository import Gtk

w = Gtk.Window()
w.set_default_size(300, 300)
w.move(200, 200) # move this line after show_all, and you see the same as on PureBasic
w.show_all()
w.connect('destroy', Gtk.main_quit)
Gtk.main()
If you run this, everything is ok, but if you move the window after the show_all(), you see the same prblem as in PB.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Fred »

Could be a workaround then to do the show_all() in HideWindow() if the invisible flag is used. I will test it and get back to you, thanks for investigating !
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by uwekel »

With PB 5.31 and gtk3 subsystem it works fine, so maybe it is not a GTK3 issue.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Fred »

I tried the workaround but it doesn't change anything here.
Niffo
Enthusiast
Enthusiast
Posts: 500
Joined: Tue Jan 31, 2006 9:43 am
Location: France

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Niffo »

For me, it is fixed in 5.43. May be the same thing than that ? : http://www.purebasic.fr/english/viewtop ... 53#p491384
Niffo
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.40LTS - Moving a window shows it at 0,0 coordinates

Post by Fred »

Could be
Post Reply