git bisect results
Quoted 65 lines · Jan Kiszka
Quoted 49 lines · Erik Rull
Quoted 48 lines · Jan Kiszka
Quoted 38 lines · Erik Rull
Quoted 26 lines · Jan Kiszka
Quoted 15 lines · Jan Kiszka
Quoted 6 lines · Erik Rull
I assume from these results that the
gui_grabis never set to 1 when having
entered the window in windowed mode with the cursor.Maybe that's why the
sdl_grab_start()is called so often.Quoted 7 lines
It seems that the condition in
sdl_grab_start()(SDL_WM_GrabInput(SDL_GRAB_ON)
==SDL_GRAB_ON) is never fulfilled, otherwise thegui_grabwould be set to 1.
But the cursor is actually grabbed in windowed mode, otherwise I would not be
able to click somewhere with the guest-windows-cursor.Quoted 7 lines
This might be a SDL limitation which does not show up everywhere. Here it's fine e.g.
The logic dates back to "Handle SDL grabs failing (Mark McLoughlin)",
6bb816031f. Maybe we can solve that issue without relying on the obviously unreliable return value. Need to reproduce that one as well, though.Please check if
Quoted 10 lines
git://git.kiszka.org/qemu.gitqueues/sdlfixes the issue for you. Namely reverting the above commit should do the
trick. I obsoleted that fragile patch in my series.Thanks,
JanQuoted 4 lines
Hi Jan,
I will test this on monday. Can you tell me how I can merge that into my cloned main qemu repository? I'm quite new to git.
# git remote add kiszka git://git.kiszka.org/qemu.git # git fetch kiszka # git checkout kiszka/queues/sdlQuoted 8 lines
Quoted 5 lines
That way you will have what I have. Or do you need additional patches for your tests?
Jan
No I think this will be sufficient. Will this work if I will add it to the qemu-kvm-1.0 tagged version?
For your test, you can focus on applying
http://git.kiszka.org/?p=qemu.git;a=commitdiff;h=0109c860ca59fddbecb47651be3cbf5135d8e82e
on the target branch.
Quoted 8 lines
Quoted 3 lines
I have further issues when using the
current master because this version does not boot up Windows XP at the moment. I was not able to bisect up to now where this issue was added.Hmm, works here. Which command line?
Jan
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch and crosschecked that the resulting file looks fine.
The final function looks like:
static void sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state. This
* prevents 'SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() & SDL_APPINPUTFOCUS)) {
return;
}
if (guest_cursor) {
SDL_SetCursor(guest_sprite);
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} else
sdl_hide_cursor();
SDL_WM_GrabInput(SDL_GRAB_ON);
gui_grab = 1;
sdl_update_caption();
}
Best regards,
Erik
Quoted 19 lines · Erik Rull
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch and crosschecked that the resulting file looks fine.
The final function looks like:
static void
sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state. This
* prevents 'SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() &SDL_APPINPUTFOCUS)) {
return;
}
if (guest_cursor) {SDL_SetCursor(guest_sprite);
Quoted 8 lines
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} elsesdl_hide_cursor();SDL_WM_GrabInput(SDL_GRAB_ON);gui_grab= 1;sdl_update_caption();
}
That makes no sense as gui_grab must be 1 now. Please retry your previous instrumentation.
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Erik Rull
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch and crosschecked that the resulting file looks fine.
Quoted 6 lines
Quoted 6 lines
The final function looks like:
static void
sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state.
This
Quoted 17 lines
Quoted 8 lines
* prevents '
SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() &SDL_APPINPUTFOCUS)) { return;
}
if (guest_cursor) {SDL_SetCursor(guest_sprite);Quoted 8 lines
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} elsesdl_hide_cursor();SDL_WM_GrabInput(SDL_GRAB_ON);gui_grab= 1;sdl_update_caption();
}
Quoted 6 lines
That makes no sense as
gui_grabmust be 1 now. Please retry your previous instrumentation.Thanks,
Jan
You're right. So I added the instrumentation again.
Still looks strange.
So I added into the sdl_grab_start() a printf.
Wow - a lot of output!
This pointed me to all other sdl_grab_start() calls (and in additon to that all sdl_grab_end() calls).
And here are the results of the qemu voting :-)
I already assigned a usable name to the printf output that is directly one line above the corresponding sdl_grab_*() call, so you should be able to find this easily in your code as well.
The huge number of recurring printf's are:
sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() sdl_grab_end() called from handle_activation()
Any idea how to proceed?
Maybe the first two if-statements in handle_activation() cause the problem? Because there the two given functions are called in sequence if both if-clauses are valid one after the other. Maybe the first one sets the state so that the second if is valid, too. Maybe a simple else if solves the issue? I'm not familiar with the variables that are checked here, so it's just a guess.
Best regards,
Erik
Quoted 74 lines · Erik Rull
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Erik Rull
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch and crosschecked that the resulting file looks fine.
Quoted 6 lines
Quoted 6 lines
The final function looks like:
static void
sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state.This
Quoted 17 lines
Quoted 8 lines
* prevents '
SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() &SDL_APPINPUTFOCUS)) { return;
}
if (guest_cursor) {SDL_SetCursor(guest_sprite);Quoted 8 lines
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} elsesdl_hide_cursor();SDL_WM_GrabInput(SDL_GRAB_ON);gui_grab= 1;sdl_update_caption();
}Quoted 6 lines
That makes no sense as
gui_grabmust be 1 now. Please retry your previous instrumentation.Thanks,
JanYou're right. So I added the instrumentation again.
Still looks strange.
So I added into the
sdl_grab_start()a printf.
Wow - a lot of output!
This pointed me to all othersdl_grab_start()calls (and in additon to that allsdl_grab_end()calls).And here are the results of the qemu voting :-)
I already assigned a usable name to the printf output that is directly one line above the corresponding sdl_grab_*() call, so you should be able to find this easily in your code as well.
The huge number of recurring printf's are:
sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()
Quoted 7 lines
Any idea how to proceed?
Maybe the first two if-statements in
handle_activation()cause the problem? Because there the two given functions are called in sequence if both if-clauses are valid one after the other. Maybe the first one sets the state so that the second if is valid, too. Maybe a simple else if solves the issue?
ev->active.gain makes both clauses mutually exclusive - unless someone messes with the memory of the event object.
Quoted 2 lines
I'm not familiar with the variables that are checked here, so it's just a guess.
So handle_activation() is called directly after absolute_mouse_grab(), and the reported event contains
state = SDL_APPINPUTFOCUS
gain = 0
(please validate!)
That would mean we are constantly losing the input focus again after trying to gain it via SDL_WM_GrabInput. Weird.
What's the call chain for absolute_mouse_grab()?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 5 lines · Jan Kiszka
Quoted 4 lines · Erik Rull
On January 30, 2012 at 12:52 PM Jan Kiszka <[email protected]>
Quoted 38 lines · wrote:
Quoted 38 lines
Quoted 7 lines · Erik Rull
Quoted 5 lines
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch and crosschecked that the resulting file looks fine.
Quoted 6 lines
Quoted 6 lines
The final function looks like:
static void
sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state.This
Quoted 23 lines
Quoted 8 lines
* prevents '
SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() &SDL_APPINPUTFOCUS)) { return;
}
if (guest_cursor) {SDL_SetCursor(guest_sprite);Quoted 8 lines
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} elsesdl_hide_cursor();SDL_WM_GrabInput(SDL_GRAB_ON);gui_grab= 1;sdl_update_caption();
}That makes no sense as
gui_grabmust be 1 now. Please retry your previous instrumentation.Thanks,
Jan
Quoted 7 lines
Quoted 7 lines
You're right. So I added the instrumentation again.
Still looks strange.
So I added into the
sdl_grab_start()a printf.
Wow - a lot of output!
This pointed me to all othersdl_grab_start()calls (and in additon to
that
Quoted 5 lines
Quoted 5 lines
all
sdl_grab_end()calls).And here are the results of the qemu voting :-)
I already assigned a usable name to the printf output that is directly
one
Quoted 1 line
Quoted 1 line
line above the corresponding sdl_grab_*() call, so you should be able
to
Quoted 19 lines
Quoted 19 lines
find this easily in your code as well.
The huge number of recurring printf's are:
sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()
Quoted 3 lines
Quoted 3 lines
Any idea how to proceed?
Maybe the first two if-statements in
handle_activation()cause the
problem?
Quoted 3 lines
Quoted 3 lines
Because there the two given functions are called in sequence if both if-clauses are valid one after the other. Maybe the first one sets the state so that the second if is valid, too. Maybe a simple else if
solves
Quoted 18 lines
Quoted 1 line
the issue?
ev->active.gainmakes both clauses mutually exclusive - unless someone messes with the memory of the event object.Quoted 2 lines
I'm not familiar with the variables that are checked here, so it's just a guess.
So
handle_activation()is called directly afterabsolute_mouse_grab(), and the reported event containsstate =
SDL_APPINPUTFOCUS
gain = 0
(please validate!)That would mean we are constantly losing the input focus again after trying to gain it via
SDL_WM_GrabInput. Weird.
Quoted 7 lines
What's the call chain for
absolute_mouse_grab()?Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
Here the results:
Handle Activation 0: at function start (before the first if) Handle Activation 1: between the first and the second if Handle Activation 2: after the second if
The output is formatted like:
printf("Handle Activation 0: %d %d %d %d\n",gui_grab,(ev->active.state == SDL_APPINPUTFOCUS),ev->active.gain,gui_fullscreen);
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0 absolute_mouse_grab() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() Handle Activation 2: 1 1 1 0
Handle Activation 0: 1 1 0 0sdl_grab_end() called from handle_activation() Handle Activation 1: 0 1 0 0
Handle Activation 2: 0 1 0 0
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0 absolute_mouse_grab() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() Handle Activation 2: 1 1 1 0
Handle Activation 0: 1 1 0 0sdl_grab_end() called from handle_activation() Handle Activation 1: 0 1 0 0
Handle Activation 2: 0 1 0 0
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0 absolute_mouse_grab() called from handle_activation() sdl_grab_start() called from absolute_mouse_grab() Handle Activation 2: 1 1 1 0
The gain seems to toggle between the successive calls of handle_activation...
Next steps?
Best regards,
Erik
Quoted 153 lines · Erik Rull
Quoted 5 lines · Jan Kiszka
Quoted 4 lines · Erik Rull
On January 30, 2012 at 12:52 PM Jan Kiszka <[email protected]>
Quoted 38 lines · wrote:
Quoted 38 lines
Quoted 7 lines · Erik Rull
Quoted 5 lines
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch and crosschecked that the resulting file looks fine.
Quoted 6 lines
Quoted 6 lines
The final function looks like:
static void
sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state.This
Quoted 23 lines
Quoted 8 lines
* prevents '
SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() &SDL_APPINPUTFOCUS)) { return;
}
if (guest_cursor) {SDL_SetCursor(guest_sprite);Quoted 8 lines
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} elsesdl_hide_cursor();SDL_WM_GrabInput(SDL_GRAB_ON);gui_grab= 1;sdl_update_caption();
}That makes no sense as
gui_grabmust be 1 now. Please retry your previous instrumentation.Thanks,
JanQuoted 7 lines
Quoted 7 lines
You're right. So I added the instrumentation again.
Still looks strange.
So I added into the
sdl_grab_start()a printf.
Wow - a lot of output!
This pointed me to all othersdl_grab_start()calls (and in additon tothat
Quoted 5 lines
Quoted 5 lines
all
sdl_grab_end()calls).And here are the results of the qemu voting :-)
I already assigned a usable name to the printf output that is directly
one
Quoted 1 line
Quoted 1 line
line above the corresponding sdl_grab_*() call, so you should be able
to
Quoted 19 lines
Quoted 19 lines
find this easily in your code as well.
The huge number of recurring printf's are:
sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()Quoted 3 lines
Quoted 3 lines
Any idea how to proceed?
Maybe the first two if-statements in
handle_activation()cause theproblem?
Quoted 3 lines
Quoted 3 lines
Because there the two given functions are called in sequence if both if-clauses are valid one after the other. Maybe the first one sets the state so that the second if is valid, too. Maybe a simple else if
solves
Quoted 18 lines
Quoted 1 line
the issue?
ev->active.gainmakes both clauses mutually exclusive - unless someone messes with the memory of the event object.Quoted 2 lines
I'm not familiar with the variables that are checked here, so it's just a guess.
So
handle_activation()is called directly afterabsolute_mouse_grab(), and the reported event containsstate =
SDL_APPINPUTFOCUS
gain = 0
(please validate!)That would mean we are constantly losing the input focus again after trying to gain it via
SDL_WM_GrabInput. Weird.Quoted 7 lines
What's the call chain for
absolute_mouse_grab()?Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded LinuxHere the results:
Handle Activation 0: at function start (before the first if) Handle Activation 1: between the first and the second if Handle Activation 2: after the second if
The output is formatted like:
printf("Handle Activation 0: %d %d %d %d\n",gui_grab,(ev->active.state == SDL_APPINPUTFOCUS),ev->active.gain,gui_fullscreen);Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0absolute_mouse_grab()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()Handle Activation 2: 1 1 1 0
Handle Activation 0: 1 1 0 0sdl_grab_end()called fromhandle_activation()Handle Activation 1: 0 1 0 0
Handle Activation 2: 0 1 0 0
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0absolute_mouse_grab()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()Handle Activation 2: 1 1 1 0
Handle Activation 0: 1 1 0 0sdl_grab_end()called fromhandle_activation()Handle Activation 1: 0 1 0 0
Handle Activation 2: 0 1 0 0
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0absolute_mouse_grab()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()Handle Activation 2: 1 1 1 0
Quoted 3 lines
The gain seems to toggle between the successive calls of
handle_activation...
Next steps?
Try this:
ui/sdl.c +0 -4
@@ -828,10 +828,6 @@ static void handle_mousebutton(DisplayState *ds, SDL_Event *ev)static void handle_activation (DisplayState *ds,SDL_Event *ev) { -if (gui_grab && ev->active.state ==SDL_APPINPUTFOCUS && - !ev->active.gain && !gui_fullscreen) { -sdl_grab_end (); - }if (!gui_grab && ev->active.gain &&is_graphic_console () && (kbd_mouse_is_absolute () || absolute_enabled)) {absolute_mouse_grab ();
I'm wondering what this code is branch should do anyway. If we grabbed the input we can't unwillingly lose it. But that's just a theory for now.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 5 lines · Jan Kiszka
Quoted 4 lines · Erik Rull
On January 30, 2012 at 2:48 PM Jan Kiszka <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines · Erik Rull
Quoted 3 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
On January 30, 2012 at 12:52 PM Jan Kiszka <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines · Erik Rull
Quoted 3 lines
Hi Jan,
I'm sorry, but this does not solve my issue. I applied the patch
and
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 8 lines
Quoted 8 lines
crosschecked that the resulting file looks fine.
The final function looks like:
static void
sdl_grab_start(void)
{
/*
* If the application is not active, do not try to enter grab state.This
Quoted 23 lines
Quoted 8 lines
* prevents '
SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
* application (SDL bug).
*/
if (!(SDL_GetAppState() &SDL_APPINPUTFOCUS)) { return;
}
if (guest_cursor) {SDL_SetCursor(guest_sprite);Quoted 8 lines
if (!kbd_mouse_is_absolute() && !absolute_enabled)
SDL_WarpMouse(guest_x, guest_y);
} elsesdl_hide_cursor();SDL_WM_GrabInput(SDL_GRAB_ON);gui_grab= 1;sdl_update_caption();
}That makes no sense as
gui_grabmust be 1 now. Please retry your previous instrumentation.Thanks,
Jan
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
You're right. So I added the instrumentation again.
Still looks strange.
So I added into the
sdl_grab_start()a printf.
Wow - a lot of output!
This pointed me to all othersdl_grab_start()calls (and in additon
to
Quoted 6 lines
Quoted 6 lines
that
Quoted 5 lines
Quoted 5 lines
all
sdl_grab_end()calls).And here are the results of the qemu voting :-)
I already assigned a usable name to the printf output that is
directly
Quoted 22 lines
Quoted 22 lines
one
Quoted 1 line
Quoted 1 line
line above the corresponding sdl_grab_*() call, so you should be able
to
Quoted 19 lines
Quoted 19 lines
find this easily in your code as well.
The huge number of recurring printf's are:
sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()sdl_grab_end()called fromhandle_activation()
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Any idea how to proceed?
Maybe the first two if-statements in
handle_activation()cause theproblem?
Quoted 2 lines
Quoted 2 lines
Because there the two given functions are called in sequence if both if-clauses are valid one after the other. Maybe the first one sets
the
Quoted 29 lines
Quoted 29 lines
Quoted 1 line
Quoted 1 line
state so that the second if is valid, too. Maybe a simple else if
solves
Quoted 25 lines
Quoted 1 line
the issue?
ev->active.gainmakes both clauses mutually exclusive - unless someone messes with the memory of the event object.Quoted 2 lines
I'm not familiar with the variables that are checked here, so it's just a guess.
So
handle_activation()is called directly afterabsolute_mouse_grab(), and the reported event containsstate =
SDL_APPINPUTFOCUS
gain = 0
(please validate!)That would mean we are constantly losing the input focus again after trying to gain it via
SDL_WM_GrabInput. Weird.What's the call chain for
absolute_mouse_grab()?Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
Quoted 8 lines
Quoted 8 lines
Here the results:
Handle Activation 0: at function start (before the first if) Handle Activation 1: between the first and the second if Handle Activation 2: after the second if
The output is formatted like:
printf("Handle Activation 0: %d %d %d %d\n",gui_grab,(ev->active.state
==
ui/sdl.c static void handle_mousebutton(DisplayState *ds,
Quoted 37 lines
Quoted 26 lines
SDL_APPINPUTFOCUS),ev->active.gain,gui_fullscreen);
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0absolute_mouse_grab()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()Handle Activation 2: 1 1 1 0
Handle Activation 0: 1 1 0 0sdl_grab_end()called fromhandle_activation()Handle Activation 1: 0 1 0 0
Handle Activation 2: 0 1 0 0
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0absolute_mouse_grab()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()Handle Activation 2: 1 1 1 0
Handle Activation 0: 1 1 0 0sdl_grab_end()called fromhandle_activation()Handle Activation 1: 0 1 0 0
Handle Activation 2: 0 1 0 0
Handle Activation 0: 0 1 1 0
Handle Activation 1: 0 1 1 0absolute_mouse_grab()called fromhandle_activation()sdl_grab_start()called fromabsolute_mouse_grab()Handle Activation 2: 1 1 1 0Quoted 3 lines
The gain seems to toggle between the successive calls of
handle_activation...
Next steps?Try this:
ui/sdl.c +0
-0@@ -828,10 +828,6 @@ static void handle_mousebutton(DisplayState *ds,
SDL_Event *ev)
Quoted 15 lines
ui/sdl.c +0
-4static void handle_activation (DisplayState *ds,SDL_Event *ev) { -if (gui_grab && ev->active.state ==SDL_APPINPUTFOCUS && - !ev->active.gain && !gui_fullscreen) { -sdl_grab_end (); - }if (!gui_grab && ev->active.gain &&is_graphic_console () && (kbd_mouse_is_absolute () || absolute_enabled)) {absolute_mouse_grab ();I'm wondering what this code is branch should do anyway. If we grabbed the input we can't unwillingly lose it. But that's just a theory for now.
Quoted 5 lines
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
That's it. Fine from my side now!
Best regards,
Erik