« Return to Thread: NSWindow receives NSAppKitDefined/GSAppKitWindowMoved strange messages with x = -1

NSWindow receives NSAppKitDefined/GSAppKitWindowMoved strange messages with x = -1

by Philippe Roussel :: Rate this Message:

| View in Thread

Hi all,

I'm currently chasing a strange behaviour. Preferences panels saving
their position with [NSWindow -setFrameAutosaveName:] and friends are
often redisplayed on the top left corner of the screen.

Looking at the application defaults I found that the x coordinate is
saved as -1. These values are saved in [NSWindow -sendEvent:] with [self
saveFrameUsingName: _autosaveName]; when reacting to the
NSAppKitDefined/GSAppKitWindowMoved message.

As I don't understand why those messages could be sent with x=-1 (and
I'm not sure y is meaninful), I used the follwing hack to cure the
problem but I hope someone will understand and fix the problem.

This is with Unity on Ubuntu 11.10.

Any ideas ?

Thanks,
Philippe

Index: Source/x11/XGServerEvent.m
===================================================================
--- Source/x11/XGServerEvent.m (révision 35115)
+++ Source/x11/XGServerEvent.m (copie de travail)
@@ -908,7 +908,9 @@
                 if (e != nil)
                   {
                     [event_queue addObject: e];
+    e = nil;
                   }
+ if (n.origin.x != -1 ) {
                 e = [NSEvent otherEventWithType: NSAppKitDefined
                              location: eventLocation
                              modifierFlags: eventFlags
@@ -918,6 +920,7 @@
                              subtype: GSAppKitWindowMoved
                              data1: n.origin.x
                              data2: n.origin.y];
+ }
               }
           }
         break;

_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@...
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

 « Return to Thread: NSWindow receives NSAppKitDefined/GSAppKitWindowMoved strange messages with x = -1