New window location

Linux specific forum
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

New window location

Post by harkon »

I am updating a program last updated using V5.31. Much seems to have changed since then. The Windows code recompiles without issue, but seems to be some issues with the linux implementation. With your help, hopefully we can slay these dragons one at a time.

I have a dual monitor setup with the primary monitor displaying my primary Linux desktop. The secondary monitor displays a Virtualbox Windows 7 machine.

The biggest issue is that when running the program, using v5.31 the program opens in the center of the primary screen as it is supposed to. Using later current versions v5.45LTS and v5.60 the window opens in the center of the combined screens, and ultimately opens on the far left center of the secondary screen. (the primary screen is on my left and secondary on my right). This doesn't work for me and very much need the functionality of the earlier versions of PB.

Any thoughts as to why the functionality changed and how to get it back?
Missed it by that much!!
HK
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: New window location

Post by skywalk »

Check your PureBasic.prefs contents before starting IDE.

Code: Select all

[Editor]
IsWindowMaximized = 0
X = 0
Y = 0
Width = 1917
Height = 1047
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

I think I may have created a misunderstanding. The problem is not with the editor.

The problem is when I run the program I have created. It opens centered to both screens combined, not to the center of the primary screen.

The open window code looks like this;

Code: Select all

OpenWindow(#Window_Loading, 537, 459, 206, 107, "Loading",  #PB_Window_BorderLess | #PB_Window_ScreenCentered )
That is the little splash screen that opens to let the user know the program is running and loading the database. After this the main window opens but again, centered on both screens combined. This behavior is new to PB versions after 5.31. I do not know when this behavior started, but reverting back to v5.31 the program runs normally, 5.45LTS and later the program opens centered on both screens.
Missed it by that much!!
HK
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: New window location

Post by ts-soft »

This behavior is new to PB versions after 5.31.
You are using GTK3 per Default, the Default for PB5.31 is GTK2!

Change the subsystem to GTK2.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

ts-soft wrote:
This behavior is new to PB versions after 5.31.
You are using GTK3 per Default, the Default for PB5.31 is GTK2!

Change the subsystem to GTK2.
To be clear, everything works really well when compiled with PB5.31.

My understanding of the subsystems and system architecture is somewhat limited. Simply googling changing subsystem from GTK3 to GTK2 left me without any clear direction. Any help regarding accomplishing this is greatly appreciated. I know it's a bit out of the scope of this forum, so I appreciate any direction here.
Missed it by that much!!
HK
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: New window location

Post by ts-soft »

The old subsystem was GTK2, the new one is GTK3. To compatible with old systems, use subsytem GTK2

Subsystems
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

Thanks for your help TS. I'm not sure how to use GTK2 vs. GTK3. When opening the window I am using only native PB code, so how do I make that native PB code use GTK2? I have noticed that in the compiler options there is the ability to specify the subsystem library. Simply putting "gtk2" (no quotes) ion there does not generate an error, but also does not change the behavior of the compiled program. Trying almost anything else in there generates an error. Doing this has changed the appearance (some of the gadgets had changed size and that was solved by putting gtk2 in the library subsystem box, but it still wants to open centered to both screens as opposed to the primary screen.

So, thanks for your help, you solved every other problem I was having with updating this program :))

Any thoughts as to why it still wants to open centered on both screens, and how to get it not to do that?
Missed it by that much!!
HK
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: New window location

Post by ts-soft »

Any thoughts as to why it still wants to open centered on both screens, and how to get it not to do that?
This is a linux-setting and have nothing to do with pb!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

ts-soft wrote:
Any thoughts as to why it still wants to open centered on both screens, and how to get it not to do that?
This is a linux-setting and have nothing to do with pb!
Thanks again for your help.
The exact same code, compiled within minutes of each other, one with v5.31 and the other with v5.45LTS (using gtk2) act differently. I would think if it were strictly a Linux setting, that this would not be so.

As well this code;

Code: Select all

  If StartDrawing(WindowOutput(Window))
     Color.i = Point(5, 5)
    StopDrawing()
  EndIf
Returns a value when compiled with v5.31, in v5.45LTS (gtk2) this generates an error. Using v5.45LTS in Windows it does return a value as well.

I don't know but it seems as there is more to this.
Missed it by that much!!
HK
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: New window location

Post by mk-soft »

Drawing on WindowOutput don´t work at some functions with gtk3. Please use subsystem gtk2.

Or drawing on CanvasGadget...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

mk-soft wrote:Drawing on WindowOutput don´t work at some functions with gtk3. Please use subsystem gtk2.

Or drawing on CanvasGadget...
Thanks. I am using gtk2 as a subsystem. That doesn't seem to make a difference for that problem specifically.

An additional note on this. When the PB IDE opens the splash opens centered on both screens. The IDE window still locates as before.
Missed it by that much!!
HK
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: New window location

Post by Oma »

Hi harkon,
I can confirm this behaviour, but with restriction.
Only certain (or one?) window manager are concerned.
On my Mint KDE with PB > 5.4 the Windows with #PB_Window_ScreenCentered are (in Linux terms) 'Screen'-centered. 'Screen' means the sum of both monitor-sizes.
On earlier PB-Versions or other window managers the window is 'window'-centered - just as it is presumably meant by PB.

This is imho not completely bug-free on PB-side.

Charly
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

Oma wrote:Hi harkon,
I can confirm this behaviour, but with restriction.
Only certain (or one?) window manager are concerned.
On my Mint KDE with PB > 5.4 the Windows with #PB_Window_ScreenCentered are (in Linux terms) 'Screen'-centered. 'Screen' means the sum of both monitor-sizes.
On earlier PB-Versions or other window managers the window is 'window'-centered - just as it is presumably meant by PB.

This is imho not completely bug-free on PB-side.

Charly
Thanks for verifying this. The whole GTK2 vs GTK3 thing is odd as well. When using only PB native calls, I would assume that windows would render about the same between GTK2 and GTK3 and Windows. The window dressings will be different, that is understood, but I am seeing gadgets sized and located differently (when using GTK3). No matter in this case as simply specifying GTK2 as a default solves the problem, but making an app cross platform if one wants to use GTK3 would almost necessitate just coding 2 separate apps, or at least 2 different GUIs. I cannot imaging the challenges the the PB maintainers face in having all of this work seamlessly so I am not complaining, only pointing out what it is I am experiencing at this end. I am on Linux Mint 17.3 Cinnamon.
Missed it by that much!!
HK
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: New window location

Post by harkon »

*** Update ***
I've gotten nowhere on the screen centered issue or why programs compiled using GTK3 look different than those compiled using GTK2. This makes the forms editor good only as a guideline. That's still better than nothing, but not as dummy proof as under Windows. C'est la vie, no huge deal. I have worked around the screen centering issue, for now, by just centering on Desktop #0, using ExamineDesktop() and getting width and height and calculating center. This works for now as long as I need it opened on my primary desktop. Getting the mouse coordinates could help me figure out which monitor I'm on and go from there, but for now this works.

I liked the way screen centering worked before this was changed.
Missed it by that much!!
HK
Post Reply