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

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

by Fred Kiefer :: Rate this Message:

| View in Thread

On 27.04.2012 19:44, Philippe Roussel wrote:

> 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;

Hi Philippe,

you code may work around the problem, but I would like to first
understand what is causing it. You could add a break point on your new
code to see what is causing it. In addition you could add the switches
"--GNU-Debug=NSEvent --GNU-Debug=Moving --GNU-Debug=Frame" to your
command line to see more debug output. That way we may be able to
understand how this nonsensical value get created.

It could be that the line
n = [self _XFrameToOSFrame: x for: cWin];
converts the correct X values into wrong OS values. This would mean that
we are using the wrong style offset values. Which window manager are you
using? Is this properly supported by our  _checkStyle: code?
Here the command line switch "--GNU-Debug=Offset" should give you more
information.

Fred




_______________________________________________
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