Fix allegro apps which start fullscreen failing to start from gnome-shell
with a "Can not grab keyboard" error message
This commit is contained in:
parent
c808d617fc
commit
2f772bc433
2 changed files with 51 additions and 1 deletions
43
allegro-4.4.2-keybgrab-fix.patch
Normal file
43
allegro-4.4.2-keybgrab-fix.patch
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
diff -up allegro-4.4.2/src/x/xwin.c~ allegro-4.4.2/src/x/xwin.c
|
||||
--- allegro-4.4.2/src/x/xwin.c~ 2015-06-23 11:04:53.000000000 +0200
|
||||
+++ allegro-4.4.2/src/x/xwin.c 2015-06-23 11:09:33.010580738 +0200
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "xwin.h"
|
||||
|
||||
#include <string.h>
|
||||
+#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/cursorfont.h>
|
||||
@@ -736,6 +736,8 @@ static void _xwin_private_setup_driver_d
|
||||
static BITMAP *_xwin_private_create_screen(GFX_DRIVER *drv, int w, int h,
|
||||
int vw, int vh, int depth, int fullscreen)
|
||||
{
|
||||
+ int i;
|
||||
+
|
||||
if (_xwin.window == None) {
|
||||
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("No window"));
|
||||
return 0;
|
||||
@@ -816,8 +818,20 @@ static BITMAP *_xwin_private_create_scre
|
||||
XReparentWindow(_xwin.display, _xwin.window, _xwin.fs_window, 0, 0);
|
||||
|
||||
/* Grab the keyboard and mouse. */
|
||||
- if (XGrabKeyboard(_xwin.display, XDefaultRootWindow(_xwin.display), False,
|
||||
- GrabModeAsync, GrabModeAsync, CurrentTime) != GrabSuccess) {
|
||||
+
|
||||
+ /*
|
||||
+ * Sometimes the window-manager has grabbed the keyboard while it is
|
||||
+ * starting an allegro app, so if grabing fails retry for 2 seconds
|
||||
+ * before giving up.
|
||||
+ */
|
||||
+ for (i = 0; i < 20; i++) {
|
||||
+ if (XGrabKeyboard(_xwin.display, XDefaultRootWindow(_xwin.display), False,
|
||||
+ GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess)
|
||||
+ break;
|
||||
+
|
||||
+ usleep(100000); /* Sleep 100 ms before retrying */
|
||||
+ }
|
||||
+ if (i == 20) {
|
||||
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not grab keyboard"));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Name: allegro
|
||||
Version: 4.4.2
|
||||
Release: 12%{?dist}
|
||||
Release: 13%{?dist}
|
||||
|
||||
Summary: A game programming library
|
||||
Summary(es): Una libreria de programacion de juegos
|
||||
|
|
@ -29,6 +29,8 @@ Patch7: allegro-4.4.2-doc-install.patch
|
|||
Patch8: allegro-4.4.2-mutex-fix.patch
|
||||
# Calling Xsync from the bg thread causes deadlock issues
|
||||
Patch9: allegro-4.4.2-no-xsync-from-thread.patch
|
||||
# gnome-shell starts apps while gnome-shell has the keyb grabbed...
|
||||
Patch10: allegro-4.4.2-keybgrab-fix.patch
|
||||
BuildRequires: texinfo cmake
|
||||
BuildRequires: xorg-x11-proto-devel libX11-devel libXpm-devel libXcursor-devel
|
||||
BuildRequires: libXxf86vm-devel libXxf86dga-devel libGL-devel libGLU-devel
|
||||
|
|
@ -247,6 +249,7 @@ developing applications that use logg.
|
|||
%endif
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
|
||||
|
||||
%build
|
||||
|
|
@ -415,6 +418,10 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Tue Jun 23 2015 Hans de Goede <hdegoede@redhat.com> - 4.4.2-13
|
||||
- Fix allegro apps which start fullscreen failing to start from gnome-shell
|
||||
with a "Can not grab keyboard" error message
|
||||
|
||||
* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.4.2-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue