Closed mclarenlabs closed 3 months ago
brilliant! This was bothering me for sometime too.
Looks like good solution. GSDE fork of WindowMaker has simple GNUstep bridge that could be used to received/send notification. In addition, it has dbus interface. I'll think of the best way to incorporate your changes into the main code ASAP.
Many thanks Tom!
I integrated your fixes and added some of my own. Most of the applications work now. GWorkspace still has problems with small icons. I'm still investigating how to solve that problem.
When you integrated the changes - do the Display and Screen Preferences modules work better for you too?
One other change related to screen size changes. In OSEScreen.m, when the screen size changes, it is either BIGGER or SMALLER.
The BIGGER part is here
if (newPixSize.width > sizeInPixels.width && newPixSize.height > sizeInPixels.height) { NSDebugLLog(@"Screen", @"OSEScreen: set new BIGGER screen size: START"); XRRSetScreenSize(xDisplay, xRootWindow, (int)newPixSize.width, (int)newPixSize.height, (int)mmSize.width, (int)mmSize.height);
and the SMALLER part is here
// If new screen size is SMALLER - set new screen size here if (newPixSize.width < sizeInPixels.width || newPixSize.height < sizeInPixels.height) { NSDebugLLog(@"Screen", @"OSEScreen: set new SMALLER screen size: START");
But, If the screen size is LARGER in height but EQUAL in width, or EQUAL in height but LARGER in width, then no change happens. We also do not want to trigger a screen resize if the old and new are exactly EQUAL, so I changed the BIGGER part to look like this
if ((newPixSize.width > sizeInPixels.width && newPixSize.height > sizeInPixels.height) || (newPixSize.width > sizeInPixels.width && newPixSize.height == sizeInPixels.height) || (newPixSize.width == sizeInPixels.width && newPixSize.height > sizeInPixels.height)) { NSDebugLLog(@"Screen", @"OSEScreen: set new BIGGER screen size: START"); XRRSetScreenSize(xDisplay, xRootWindow, (int)newPixSize.width, (int)newPixSize.height, (int)mmSize.width, (int)mmSize.height);
and that behaves better when only one of the dimensions gets larger.
I have not tested this change in a VM, FYI.
should be fixed now. Just make sure you use gs-workspace and gnustep-gui forks GSDE comes with. The changes were not merged upstream yet.
I recently set up gs-desktop on a new laptop, and one of the first things I did was use the nextspace/Preferences application to set screen resolutions for both the internal and external monitor. The application worked somewhat, but did not behave very well. After changing the resolution of the internal monitor, the images in the App disappeared and the widgets did not update correctly. I decided to investigate.
(FWIW: I like to change screen resolutions depending on whether I am at home or somewhere else.)
I think I have fixed some of the problems.
There were three main causes
in NSImage.m, the default caching method of NSIMageCacheDefault does not work well with resolution changes. NSImages that have been cached do not seem to get redrawn after the screen resolution has been changed. Changing it to NSImageCacheNever fixes problems for Preferences (and a number of other apps like Gorm, VolMon and MountUp I think).
nextspace/SystemKit/OSEScreen.m expects the Workspace Manager to send it a NSDistributedNotification that the screen has changed. Since gs-desktop uses WindowMaker rather than nextspace/WorkspaceManager, this notification is not delivered.
A workaround is to catch the low-level notification about screen changes directly and respond to that.
Preferences/Modules/Display/Display.m has a race condition, whereby changing the screen resolution before returning from an IBAction for a button leaves a widget in an undefined state.
With these three changes, both the "Display" and "Screens" modules of the nextspace/Preferences application work smoothly for me.
I found a good reference for the original notification architecture involving WorkspaceManager sending the distributed notification is in the following commit.
https://github.com/onflapp/nextspace/commit/62e30521934ae04dbe10e2fd0ea46738a9d6cb89
I'm not sure if the notification fix I suggested to OSEScreen.m is the right long-term approach, or if an approach whereby the window manager (WindowMaker) is changed to send a DistributedNotification to all of the running applications. But since WindowMaker is not a gnustep application, it would be difficult to get it to send the required notification.
Rather than prepare pull requests with these changes, I'm going to share my results here to get some feedback.
I'm pretty happy with the result. The Preferences Application now remembers resolution settings for the configuration where I have two monitors (an internal and an external) and a different configuration where I only have the internal monitor. It's very nice now.
-Tom
The Diffs to the Three Files appears below.