Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xfce] "Remember window properties" does not remember undocked channel window sizes and positions #2487

Open
AlexFolland opened this issue Sep 6, 2020 · 1 comment

Comments

@AlexFolland
Copy link

For context about this report, I switched from Windows 7 to Manjaro with XFCE last weekend. Before switching, I was using mIRC in Windows 7, with a tiled layout with all the window positions saved within the main window, so that I could see all my ~15 open IRC channel windows on one screen.

I have just started using KVIrc today and I've browsed all the options in the program, I think. I've seen "Remember window properties" in the main settings "Interface" section, and "Set Window Properties As Default" in channel tree context menus. My goal is to set up an xfce workspace with my windows in nice tiled positions like I was able to do in mIRC in Windows. In mIRC, I could set all my window positions, then save them all so that they would remain the same between sessions. I'd like to accomplish the same thing here.

"Remember window properties" doesn't seem to do that. The only property it seems to remember is whether the channel window is undocked, but that's not much of a property to remember. Of course that's useful, but it's not the workspace, (x,y) position, length/width dimensions, which are the window properties I was expecting the setting to remember. After setting up my tiled channel windows, making sure that setting was enabled, and restarting, the channel windows appeared undocked but all stacked in exactly the same position and exactly the same size, which was not the size I'd set for any of the windows.

mIRC has a set of options in each channel's context menu that does the saving that makes this work, so I also tried using "Set Window Properties As Default" from each channel's context menu, and that didn't seem to work to make new channel windows appear with the same size and position, so I'm not sure what it even does.

Here's the executable information requested:

KVIrc 5.0.0 'Aria'

Runtime Info:
System name: Linux 5.8.3-2-MANJARO
System version: #1 SMP PREEMPT Sat Aug 22 12:35:25 UTC 2020
Architecture: x86_64
Qt version: 5.15.0
Qt theme: qt5ct-style

Build Info:
Build date: 2020-06-04 15:00:10 UTC
Sources date: 20160102
Revision number:
CPU name: x86_64
Build command: /usr/bin/cmake
Build flags:
MANDIR=share/man
CMAKE_INSTALL_PREFIX=/usr
LIB_SUFFIX=
Threads=POSIX
Compiler name: /usr/bin/c++
Compiler flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt
Qt version: 5.15.0
Features: IRC, IPv6, Crypt, SSL, IfAddr, IPC, OSS, Transparency, DCCVoice, Perl, Python, Enchant, Qt5, KVS
OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
OpenSSL compiler flags: compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG -D_FORTIFY_SOURCE=2
OpenSSL built on: Sun May 24 19:14:32 2020 UTC

@CyberShadow
Copy link
Collaborator

Generally on the Linux desktop ecosystem, this task is better suited for window managers, not individual applications. E.g. i3 has built-in support for layout saving:
https://i3wm.org/docs/layout-saving.html

That said, you could try this patch:

diff --git a/src/kvirc/ui/KviMainWindow.cpp b/src/kvirc/ui/KviMainWindow.cpp
index 016db92e6..bb338dc91 100644
--- a/src/kvirc/ui/KviMainWindow.cpp
+++ b/src/kvirc/ui/KviMainWindow.cpp
@@ -396,6 +396,10 @@ void KviMainWindow::saveWindowProperties(KviWindow * wnd, const QString & szSect
 	g_pWinPropertiesConfig->setGroup(szSection);
 
 	g_pWinPropertiesConfig->writeEntry("IsDocked", wnd->isDocked());
+	g_pWinPropertiesConfig->writeEntry("X", wnd->pos().x());
+	g_pWinPropertiesConfig->writeEntry("Y", wnd->pos().y());
+	g_pWinPropertiesConfig->writeEntry("Width", wnd->size().width());
+	g_pWinPropertiesConfig->writeEntry("Height", wnd->size().height());
 
 	wnd->saveProperties(g_pWinPropertiesConfig);
 }
@@ -547,6 +551,12 @@ void KviMainWindow::addWindow(KviWindow * wnd, bool bShow)
 				wnd->raise();
 				wnd->setFocus();
 			}
+			int x = g_pWinPropertiesConfig->readIntEntry("X", wnd->pos().x());
+			int y = g_pWinPropertiesConfig->readIntEntry("Y", wnd->pos().y());
+			int w = g_pWinPropertiesConfig->readIntEntry("Width", wnd->size().width());
+			int h = g_pWinPropertiesConfig->readIntEntry("Height", wnd->size().height());
+			wnd->move(x, y);
+			wnd->resize(w, h);
 		}
 	}
 	else

Note that Qt doesn't seem to have a notion of workspace (presumably because not all target environments have it), so at least that part would have to be done externally. Also, environments such as Wayland do not allow applications to query and set window coordinates, so this wouldn't work there either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants