Incorrect startup monitor

Bug #610248 reported by Francois Botha
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LinuxDC++
Confirmed
Medium
Unassigned

Bug Description

I have a dual-monitor setup with my secondary monitor on the left and primary monitor on the right.

On first startup (when LinuxDCPP.xml doesn't exist), LinuxDC++ will open at position X=100 (which is on the secondary monitor) instead of something > 1024 (primary monitor). I then have to drag it over to my primary monitor.

Also, because I immediately maximized my window (and never unmaximized it), the X position is never saved. After months of frustration I realised this only after inspecting the code myself (workaround was to unmaximize, drag over to primary and quit program so that X saved as > 1024).

I see the latest GTK has a gdk_screen_get_primary_monitory() function which could aid with this? But what is the minimum requirements in terms of GTK?

PS: To add to my frustration, my secondary monitor is actually my TV, which isn't always on. I had to switch on the TV so that I could drag the LinuxDC++ window over.

Revision history for this message
Francois Botha (igitur) wrote :

Also, I don't agree with this comment in mainwindow.cc:
// The get pos/size functions return junk when window is maximized
I think main-window-pos-x and -y should always be saved, not only when the window is UNmaximized.

That will solve this problem partially. Only the very first time the window will be on the wrong monitor.

Revision history for this message
Steven Sheehy (steven-sheehy) wrote :

I agree, it should be fixed. gdk_screen_get_primary_monitor() is brand new in GTK+ 2.20 and since we support down to 2.10, it can't be used directly. However, I will accept a patch with #if GTK_CHECK_VERSION (2, 20, 1) around the function. Since I don't have a dual monitor setup I can't really fix/test it myself.

About the get pos/size functions returning junk, that was there because they literally did return junk at one point. That is, they didn't return values in the range [0, screen_size] when the window was maximized. However, looking at it now it seems GTK+ must've fixed the bug that caused that and it returns valid values now. The problem with saving the maximized value is that when you unmaximize your window it doesn't go back to the size you had before it was maximized. In fact, it stays at a size almost the same as the maximized window, making it seems as if the unmaximize button didn't function properly.

If you have an issue with it not showing up on the correct monitor I say we fix that instead of trying to workaround the issue by saving the maximized values to help for your specific case. That's my opinion at least.

Changed in linuxdcpp:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Francois Botha (igitur) wrote :

Can't we just remove the window position / size stuff? On my Ubuntu Lucid that's all taken care of by the window manager. Don't know if that's the case in all distributions though. But my gut feel is that someone with a dual monitor setup will have an advanced window manager at least :)

I can confirm that if I remove the gets and sets of the window position / size values, everything works 100% here.

Revision history for this message
Razzloss (razzloss) wrote :

It should be up to the WM to position the window. So I'd remove the size/position setting, at least when there's no previous values saved. Don't know if someone wants it to remember the previous position and restore to that no matter what (maybe make it optional?)

BTW. If the window is closed on a monitor and then that monitor is removed will it restore itself to outside the visible area on next startup?

Revision history for this message
Francois Botha (igitur) wrote :

This patch removes all saving / retrieving of window size / position. Let the window manager do it.

Revision history for this message
Francois Botha (igitur) wrote :

Ignore the previous patch.

Revision history for this message
Steven Sheehy (steven-sheehy) wrote :

I'm on Ubuntu Lucid and it does not remember the size and position of the window with this patch applied. That being said, I'm ok with allowing the window manager to position the window, but not its size. Most applications remember their last size when closing. Having to readjust the size each time is extremely annoying. Besides, the app is still setting the default size in the glade file. With that removed, metacity is setting the window too small each time it is started.

Revision history for this message
Francois Botha (igitur) wrote :

From the GtkWindow documentation:

If you are saving and restoring your application's window positions, you should know that it's impossible for applications to do this without getting it somewhat wrong because applications do not have sufficient knowledge of window manager state. The Correct Mechanism is to support the session management protocol (see the "GnomeClient" object in the GNOME libraries for example) and allow the window manager to save your window sizes and positions.

Don't know where I got the idea that the window state is automatically saved by the window manager.

Revision history for this message
Francois Botha (igitur) wrote :

But then on http://developer.gnome.org/doc/GGAD/sec-sessionmanagement.html

"Applications should not save their current window geometries; the window manager is responsible for that."

Ok, I'm confused.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.