The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Cocoa mouse down/up event issues.
marksibly


Joined: 02 Jul 2015
Posts: 14
Hi,

Cocoa appears to be sending SDL apps 'mouse down' events when a window's title bar is clicked, but no 'mouse up'.


I managed to fix this via adding something like the follow (copied from somewhere else if sdl) to the mouseDown and mouseUp methods in SDL_cocoawindow.m



 /* Ignore events that aren't inside the client area (i.e. title bar.) */
if ([theEvent window]) {
NSRect windowRect = [[[theEvent window] contentView] frame];
if (!NSPointInRect([theEvent locationInWindow], windowRect)) {
return;
}
}


This completely rejects mouse events that happen in the title bar, but that's 100% fine with me and I think is what happens on windows anyway?


This doesn't appear to be in the hg repos so I thought I should at least mention it here.


Bye,
Mark
Cocoa mouse down/up event issues.
Alex Szpakowski
Guest

This appears to have already been fixed in SDL’s code a few months ago: https://hg.libsdl.org/SDL/rev/525f13ccf27f

Does the latest code work as expected for you?

Quote:
On Nov 15, 2015, at 12:02 AM, Mark Sibly wrote:

Hi,

Cocoa appears to be sending SDL apps 'mouse down' events when a window's title bar is clicked, but no 'mouse up'.

I managed to fix this via adding something like the follow (copied from somewhere else if sdl) to the mouseDown and mouseUp methods in SDL_cocoawindow.m

/* Ignore events that aren't inside the client area (i.e. title bar.) */
if ([theEvent window]) {
NSRect windowRect = [[[theEvent window] contentView] frame];
if (!NSPointInRect([theEvent locationInWindow], windowRect)) {
return;
}
}

This completely rejects mouse events that happen in the title bar, but that's 100% fine with me and I think is what happens on windows anyway?

This doesn't appear to be in the hg repos so I thought I should at least mention it here.

Bye,
Mark

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Cocoa mouse down/up event issues.
marksibly


Joined: 02 Jul 2015
Posts: 14
So it is - was sure I'd checked the file. Anyway, that fix does work for me so all's good.

Should I be using hg SDL? I tried a few months back but there were problems building the XInput stuff under mingw.






On Sun, Nov 15, 2015 at 5:07 PM, Alex Szpakowski wrote:
Quote:
This appears to have already been fixed in SDL’s code a few months ago: https://hg.libsdl.org/SDL/rev/525f13ccf27f

Does the latest code work as expected for you?

Quote:
On Nov 15, 2015, at 12:02 AM, Mark Sibly wrote:

Hi,

Cocoa appears to be sending SDL apps 'mouse down' events when a window's title bar is clicked, but no 'mouse up'.

I managed to fix this via adding something like the follow (copied from somewhere else if sdl) to the mouseDown and mouseUp methods in SDL_cocoawindow.m

  /* Ignore events that aren't inside the client area (i.e. title bar.) */
if ([theEvent window]) {
NSRect windowRect = [[[theEvent window] contentView] frame];
if (!NSPointInRect([theEvent locationInWindow], windowRect)) {
return;
}
}

This completely rejects mouse events that happen in the title bar, but that's 100% fine with me and I think is what happens on windows anyway?

This doesn't appear to be in the hg repos so I thought I should at least mention it here.

Bye,
Mark



Quote:
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Cocoa mouse down/up event issues.
Sik


Joined: 26 Nov 2011
Posts: 905
2015-11-15 1:19 GMT-03:00, Mark Sibly:
Quote:
Should I be using hg SDL? I tried a few months back but there were problems
building the XInput stuff under mingw.

Vanilla MinGW is horribly outdated and doesn't even support the XInput
API, use MinGW-w64 instead and all those problems will be gone. (yes,
it can build both 32-bit and 64-bit)
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Michael


Joined: 01 Feb 2016
Posts: 2
Hello, I am having a similar issue and I was hopping that you guys might be able to help.

What I am doing is the following:

Click inside SDL_Window, I get the mousedown event, I destroy the window to change the resolution. When the windows is created again the first click is always mouseup for some reason.

I tried to Flush all events before destroying the window but didn't work.

any suggestions?