SHA256
1
0
forked from pool/SDL2

Accepting request 459827 from games

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/459827
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/SDL2?expand=0&rev=14
This commit is contained in:
Dominique Leuenberger 2017-02-26 15:59:49 +00:00 committed by Git OBS Bridge
commit 593ec7470c
4 changed files with 243 additions and 5 deletions

View File

@ -1,5 +1,7 @@
# https://bugzilla.libsdl.org/show_bug.cgi?id=3466
# commits 5184186d4366 and fbf9b0e3589a
# PATCH-FIX-UPSTREAM SDL2-declaration-after-statement.patch
# backported to fix build on Factory/ppc64, cf. https://bugzilla.libsdl.org/show_bug.cgi?id=3466
#
diff -udpr SDL2-2.0.5.orig/src/video/SDL_blit_N.c SDL2-2.0.5/src/video/SDL_blit_N.c
--- SDL2-2.0.5.orig/src/video/SDL_blit_N.c 2016-10-20 05:56:26.000000000 +0200

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Feb 15 11:51:52 UTC 2017 - jengelh@inai.de
- Add dbus-ime.diff and build with fcitx [boo#1025413]
-------------------------------------------------------------------
Sun Oct 23 08:00:21 UTC 2016 - aloisio@gmx.com

View File

@ -1,7 +1,7 @@
#
# spec file for package SDL2
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -30,9 +30,8 @@ Source: http://libsdl.org/release/%name-%version.tar.gz
Source2: http://libsdl.org/release/%name-%version.tar.gz.sig
Source3: %name.keyring
Source4: baselibs.conf
# PATCH-FIX-UPSTREAM SDL2-declaration-after-statement.patch
# backported to fix build on Factory/ppc64, cf. https://bugzilla.libsdl.org/show_bug.cgi?id=3466
Patch0: %{name}-ppc64-declaration-after-statement.patch
Patch1: %{name}-ppc64-declaration-after-statement.patch
Patch2: dbus-ime.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: cmake
BuildRequires: dos2unix
@ -41,6 +40,7 @@ BuildRequires: nasm
BuildRequires: pkg-config
BuildRequires: pkgconfig(alsa) >= 0.9.0
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(fcitx)
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(glu)
@ -108,8 +108,9 @@ library.
%prep
%setup -q
%ifarch ppc64 ppc64le
%patch0 -p1
%patch -P 1 -p1
%endif
%patch -P 2 -p1
dos2unix WhatsNew.txt
dos2unix TODO.txt
dos2unix BUGS.txt

230
dbus-ime.diff Normal file
View File

@ -0,0 +1,230 @@
# HG changeset patch
# User Alex Baines <alex@abaines.me.uk>
# Date 1477614538 -3600
# Node ID b48d8a98e2618a6b4fd45aa2aab290ba4eb113c2
# Parent 35fee69e84dfd745ef34e392e481f9088aeff70c
Fix double events / no repeat flag on key events when built withoutibus/fcitx
Uses XkbSetDetectableKeyRepeat, and falls back to forcing @im=none if it's not
supported.
diff -r 35fee69e84df -r b48d8a98e261 src/video/x11/SDL_x11events.c
--- a/src/video/x11/SDL_x11events.c Fri Oct 28 17:00:37 2016 -0700
+++ b/src/video/x11/SDL_x11events.c Fri Oct 28 01:28:58 2016 +0100
@@ -568,14 +568,18 @@
printf("Filtered event type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window);
#endif
+ /* Make sure dead key press/release events are sent */
+ /* But only if we're using one of the DBus IMEs, otherwise
+ some XIM IMEs will generate duplicate events */
if (orig_keycode) {
- /* Make sure dead key press/release events are sent */
+#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
SDL_Scancode scancode = videodata->key_layout[orig_keycode];
if (orig_event_type == KeyPress) {
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
} else {
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
}
+#endif
}
return;
}
diff -r 35fee69e84df -r b48d8a98e261 src/video/x11/SDL_x11keyboard.c
--- a/src/video/x11/SDL_x11keyboard.c Fri Oct 28 17:00:37 2016 -0700
+++ b/src/video/x11/SDL_x11keyboard.c Fri Oct 28 01:28:58 2016 +0100
@@ -33,6 +33,10 @@
#include "imKStoUCS.h"
+#ifdef X_HAVE_UTF8_STRING
+#include <locale.h>
+#endif
+
/* *INDENT-OFF* */
static const struct {
KeySym keysym;
@@ -262,19 +266,82 @@
int best_distance;
int best_index;
int distance;
-
+ BOOL xkb_repeat = 0;
+
X11_XAutoRepeatOn(data->display);
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
{
- int xkb_major = XkbMajorVersion;
- int xkb_minor = XkbMinorVersion;
- if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
- data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
- }
- }
+ int xkb_major = XkbMajorVersion;
+ int xkb_minor = XkbMinorVersion;
+
+ if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
+ data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
+ }
+
+ /* This will remove KeyRelease events for held keys */
+ X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat);
+ }
#endif
+
+ /* Open a connection to the X input manager */
+#ifdef X_HAVE_UTF8_STRING
+ if (SDL_X11_HAVE_UTF8) {
+ /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that
+ Compose keys will work correctly. */
+ char *prev_locale = setlocale(LC_ALL, NULL);
+ char *prev_xmods = X11_XSetLocaleModifiers(NULL);
+ const char *new_xmods = "";
+#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
+ const char *env_xmods = SDL_getenv("XMODIFIERS");
+#endif
+ SDL_bool has_dbus_ime_support = SDL_FALSE;
+ if (prev_locale) {
+ prev_locale = SDL_strdup(prev_locale);
+ }
+
+ if (prev_xmods) {
+ prev_xmods = SDL_strdup(prev_xmods);
+ }
+
+ /* IBus resends some key events that were filtered by XFilterEvents
+ when it is used via XIM which causes issues. Prevent this by forcing
+ @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
+ the DBus implementation, which also has support for pre-editing. */
+#ifdef HAVE_IBUS_IBUS_H
+ if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
+ has_dbus_ime_support = SDL_TRUE;
+ }
+#endif
+#ifdef HAVE_FCITX_FRONTEND_H
+ if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
+ has_dbus_ime_support = SDL_TRUE;
+ }
+#endif
+ if (has_dbus_ime_support || !xkb_repeat) {
+ new_xmods = "@im=none";
+ }
+
+ setlocale(LC_ALL, "");
+ X11_XSetLocaleModifiers(new_xmods);
+
+ data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
+
+ /* Reset the locale + X locale modifiers back to how they were,
+ locale first because the X locale modifiers depend on it. */
+ setlocale(LC_ALL, prev_locale);
+ X11_XSetLocaleModifiers(prev_xmods);
+
+ if (prev_locale) {
+ SDL_free(prev_locale);
+ }
+
+ if (prev_xmods) {
+ SDL_free(prev_xmods);
+ }
+ }
+#endif
/* Try to determine which scancodes are being used based on fingerprint */
best_distance = SDL_arraysize(fingerprint) + 1;
best_index = -1;
diff -r 35fee69e84df -r b48d8a98e261 src/video/x11/SDL_x11sym.h
--- a/src/video/x11/SDL_x11sym.h Fri Oct 28 17:00:37 2016 -0700
+++ b/src/video/x11/SDL_x11sym.h Fri Oct 28 01:28:58 2016 +0100
@@ -179,6 +179,7 @@
SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return)
SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return)
SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
+SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return)
#endif
#if NeedWidePrototypes
diff -r 35fee69e84df -r b48d8a98e261 src/video/x11/SDL_x11video.c
--- a/src/video/x11/SDL_x11video.c Fri Oct 28 17:00:37 2016 -0700
+++ b/src/video/x11/SDL_x11video.c Fri Oct 28 01:28:58 2016 +0100
@@ -39,10 +39,6 @@
#include "SDL_x11opengles.h"
#endif
-#ifdef X_HAVE_UTF8_STRING
-#include <locale.h>
-#endif
-
/* Initialization/Query functions */
static int X11_VideoInit(_THIS);
static void X11_VideoQuit(_THIS);
@@ -388,65 +384,6 @@
/* I have no idea how random this actually is, or has to be. */
data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
- /* Open a connection to the X input manager */
-#ifdef X_HAVE_UTF8_STRING
- if (SDL_X11_HAVE_UTF8) {
- /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that
- Compose keys will work correctly. */
- char *prev_locale = setlocale(LC_ALL, NULL);
- char *prev_xmods = X11_XSetLocaleModifiers(NULL);
- const char *new_xmods = "";
-#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
- const char *env_xmods = SDL_getenv("XMODIFIERS");
-#endif
- SDL_bool has_dbus_ime_support = SDL_FALSE;
-
- if (prev_locale) {
- prev_locale = SDL_strdup(prev_locale);
- }
-
- if (prev_xmods) {
- prev_xmods = SDL_strdup(prev_xmods);
- }
-
- /* IBus resends some key events that were filtered by XFilterEvents
- when it is used via XIM which causes issues. Prevent this by forcing
- @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
- the DBus implementation, which also has support for pre-editing. */
-#ifdef HAVE_IBUS_IBUS_H
- if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
- has_dbus_ime_support = SDL_TRUE;
- }
-#endif
-#ifdef HAVE_FCITX_FRONTEND_H
- if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
- has_dbus_ime_support = SDL_TRUE;
- }
-#endif
- if (has_dbus_ime_support) {
- new_xmods = "@im=none";
- }
-
- setlocale(LC_ALL, "");
- X11_XSetLocaleModifiers(new_xmods);
-
- data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
-
- /* Reset the locale + X locale modifiers back to how they were,
- locale first because the X locale modifiers depend on it. */
- setlocale(LC_ALL, prev_locale);
- X11_XSetLocaleModifiers(prev_xmods);
-
- if (prev_locale) {
- SDL_free(prev_locale);
- }
-
- if (prev_xmods) {
- SDL_free(prev_xmods);
- }
- }
-#endif
-
/* Look up some useful Atoms */
#define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False)
GET_ATOM(WM_PROTOCOLS);