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.) */
Does the latest code work as expected for you?> 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.
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:
On Nov 15, 2015, at 12:02 AM, Mark Sibly <@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.
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)
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.