Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package opentyrian for openSUSE:Factory 
checked in at 2022-03-23 20:18:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/opentyrian (Old)
 and      /work/SRC/openSUSE:Factory/.opentyrian.new.25692 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "opentyrian"

Wed Mar 23 20:18:41 2022 rev:4 rq:964237 version:2.1.20220318

Changes:
--------
--- /work/SRC/openSUSE:Factory/opentyrian/opentyrian.changes    2022-03-16 
20:21:03.520995787 +0100
+++ /work/SRC/openSUSE:Factory/.opentyrian.new.25692/opentyrian.changes 
2022-03-23 20:20:32.114535975 +0100
@@ -1,0 +2,6 @@
+Sun Mar 20 06:04:27 UTC 2022 - Carsten Ziepke <kiel...@gmail.com>
+
+- Update to 2.1.20220318
+  - Allow mouse pointer to leave window while in menus
+  
+-------------------------------------------------------------------

Old:
----
  opentyrian-2.1.20220311.obscpio

New:
----
  opentyrian-2.1.20220318.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ opentyrian.spec ++++++
--- /var/tmp/diff_new_pack.op04HB/_old  2022-03-23 20:20:32.750536335 +0100
+++ /var/tmp/diff_new_pack.op04HB/_new  2022-03-23 20:20:32.762536341 +0100
@@ -20,7 +20,7 @@
 # Upstream haven not tagged a version for more than seven years now.
 # There quite many bugfixes in the git version and it seems upstreams
 # develops it as rolling release.
-Version:        2.1.20220311
+Version:        2.1.20220318
 Release:        0
 Summary:        An arcade-style vertical scrolling shooter
 License:        GPL-2.0-or-later

++++++ opentyrian-2.1.20220311.obscpio -> opentyrian-2.1.20220318.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/README 
new/opentyrian-2.1.20220318/README
--- old/opentyrian-2.1.20220311/README  2022-03-11 17:52:04.000000000 +0100
+++ new/opentyrian-2.1.20220318/README  2022-03-18 08:13:57.000000000 +0100
@@ -17,9 +17,7 @@
 
 == Keyboard Controls 
===========================================================
 
-ctrl-backspace -- kill OpenTyrian
-alt-enter      -- fullscreen
-ctrl-f10       -- ungrab mouse
+alt-enter      -- toggle full-screen
 
 arrow keys     -- ship movement
 space          -- fire weapons
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/src/keyboard.c 
new/opentyrian-2.1.20220318/src/keyboard.c
--- old/opentyrian-2.1.20220311/src/keyboard.c  2022-03-11 17:52:04.000000000 
+0100
+++ new/opentyrian-2.1.20220318/src/keyboard.c  2022-03-18 08:13:57.000000000 
+0100
@@ -39,16 +39,18 @@
 JE_boolean mouse_pressed[3] = {false, false, false};
 Sint32 mouse_x, mouse_y;
 
+bool windowHasFocus;
+
 Uint8 keysactive[SDL_NUM_SCANCODES];
 
 bool new_text;
 char last_text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
 
-#ifdef NDEBUG
-bool input_grab_enabled = true;
-#else
-bool input_grab_enabled = false;
-#endif
+static bool mouseRelativeEnabled;
+
+// Relative mouse position in window coordinates.
+static Sint32 mouseWindowXRelative;
+static Sint32 mouseWindowYRelative;
 
 void flush_events_buffer( void )
 {
@@ -95,20 +97,18 @@
 
        newkey = newmouse = false;
        keydown = mousedown = false;
+
+       SDL_ShowCursor(SDL_FALSE);
 }
 
-void input_grab( bool enable )
+void mouseSetRelative(bool enable)
 {
-#if defined(TARGET_GP2X) || defined(TARGET_DINGUX)
-       enable = true;
-#endif
+       SDL_SetRelativeMouseMode(enable && windowHasFocus);
 
-       input_grab_enabled = enable || fullscreen_display != -1;
+       mouseRelativeEnabled = enable;
 
-       SDL_ShowCursor(input_grab_enabled ? SDL_DISABLE : SDL_ENABLE);
-#ifdef NDEBUG
-       SDL_SetWindowGrab(main_window, input_grab_enabled ? SDL_TRUE : 
SDL_FALSE);
-#endif
+       mouseWindowXRelative = 0;
+       mouseWindowYRelative = 0;
 }
 
 JE_word JE_mousePosition( JE_word *mouseX, JE_word *mouseY )
@@ -119,17 +119,16 @@
        return mousedown ? lastmouse_but : 0;
 }
 
-void set_mouse_position( int x, int y )
+void mouseGetRelativePosition(Sint32 *const out_x, Sint32 *const out_y)
 {
-       if (input_grab_enabled)
-       {
-               mouse_x = x;
-               mouse_y = y;
-               map_screen_to_window_pos(&x, &y);
-               SDL_PumpEvents();
-               SDL_FlushEvent(SDL_MOUSEMOTION);
-               SDL_WarpMouseInWindow(main_window, x, y);
-       }
+       service_SDL_events(false);
+
+       scaleWindowDistanceToScreen(&mouseWindowXRelative, 
&mouseWindowYRelative);
+       *out_x = mouseWindowXRelative;
+       *out_y = mouseWindowYRelative;
+
+       mouseWindowXRelative = 0;
+       mouseWindowYRelative = 0;
 }
 
 void service_SDL_events( JE_boolean clear_new )
@@ -148,37 +147,31 @@
                switch (ev.type)
                {
                        case SDL_WINDOWEVENT:
-                               if (ev.window.event == 
SDL_WINDOWEVENT_FOCUS_LOST)
-                                       input_grab(false);
-                               else if (ev.window.event == 
SDL_WINDOWEVENT_RESIZED)
-                                       video_on_win_resize();
-                               break;
+                               switch (ev.window.event)
+                               {
+                               case SDL_WINDOWEVENT_FOCUS_LOST:
+                                       windowHasFocus = false;
 
-                       case SDL_MOUSEMOTION:
-                               map_window_to_screen_pos(&ev.motion.x, 
&ev.motion.y);
-                               mouse_x = ev.motion.x;
-                               mouse_y = ev.motion.y;
+                                       mouseSetRelative(mouseRelativeEnabled);
+                                       break;
 
-                               if (ev.motion.xrel != 0 || ev.motion.yrel != 0)
-                                       mouseInactive = false;
-                               break;
+                               case SDL_WINDOWEVENT_FOCUS_GAINED:
+                                       windowHasFocus = true;
 
-                       case SDL_KEYDOWN:
-                               if (ev.key.keysym.mod & KMOD_CTRL)
-                               {
-                                       /* <ctrl><f10> toggle input grab */
-                                       if (ev.key.keysym.scancode == 
SDL_SCANCODE_F10)
-                                       {
-                                               input_grab(!input_grab_enabled);
-                                               break;
-                                       }
+                                       mouseSetRelative(mouseRelativeEnabled);
+                                       break;
+
+                               case SDL_WINDOWEVENT_RESIZED:
+                                       video_on_win_resize();
+                                       break;
                                }
+                               break;
 
+                       case SDL_KEYDOWN:
                                /* <alt><enter> toggle fullscreen */
                                if (ev.key.keysym.mod & KMOD_ALT && 
ev.key.keysym.scancode == SDL_SCANCODE_RETURN)
                                {
                                        toggle_fullscreen();
-                                       input_grab(false);
                                        break;
                                }
 
@@ -191,23 +184,37 @@
 
                                mouseInactive = true;
                                return;
+
                        case SDL_KEYUP:
                                keysactive[ev.key.keysym.scancode] = 0;
                                keydown = false;
                                return;
 
-                       case SDL_MOUSEBUTTONDOWN:
-                               if (!input_grab_enabled)
+                       case SDL_MOUSEMOTION:
+                               mouse_x = ev.motion.x;
+                               mouse_y = ev.motion.y;
+                               mapWindowPointToScreen(&mouse_x, &mouse_y);
+
+                               if (mouseRelativeEnabled && windowHasFocus)
                                {
-                                       input_grab(true);
-                                       break;
+                                       mouseWindowXRelative += ev.motion.xrel;
+                                       mouseWindowYRelative += ev.motion.yrel;
                                }
 
+                               // Show system mouse pointer if outside screen.
+                               SDL_ShowCursor(mouse_x < 0 || mouse_x >= 
vga_width ||
+                                              mouse_y < 0 || mouse_y >= 
vga_height ? SDL_TRUE : SDL_FALSE);
+
+                               if (ev.motion.xrel != 0 || ev.motion.yrel != 0)
+                                       mouseInactive = false;
+                               break;
+
+                       case SDL_MOUSEBUTTONDOWN:
                                mouseInactive = false;
 
                                // fall through
                        case SDL_MOUSEBUTTONUP:
-                               map_window_to_screen_pos(&ev.button.x, 
&ev.button.y);
+                               mapWindowPointToScreen(&ev.button.x, 
&ev.button.y);
                                if (ev.type == SDL_MOUSEBUTTONDOWN)
                                {
                                        newmouse = true;
@@ -235,6 +242,7 @@
                                SDL_strlcpy(last_text, ev.text.text, 
COUNTOF(last_text));
                                new_text = true;
                                break;
+
                        case SDL_TEXTEDITING:
                                break;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/src/keyboard.h 
new/opentyrian-2.1.20220318/src/keyboard.h
--- old/opentyrian-2.1.20220311/src/keyboard.h  2022-03-11 17:52:04.000000000 
+0100
+++ new/opentyrian-2.1.20220318/src/keyboard.h  2022-03-18 08:13:57.000000000 
+0100
@@ -37,18 +37,18 @@
 extern Sint32 mouse_x, mouse_y;
 extern Uint8 keysactive[SDL_NUM_SCANCODES];
 
+extern bool windowHasFocus;
+
 extern bool new_text;
 extern char last_text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
 
-extern bool input_grab_enabled;
-
 void flush_events_buffer( void );
 void wait_input( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick );
 void wait_noinput( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick 
);
 void init_keyboard( void );
-void input_grab( bool enable );
+void mouseSetRelative(bool enable);
 JE_word JE_mousePosition( JE_word *mouseX, JE_word *mouseY );
-void set_mouse_position( int x, int y );
+void mouseGetRelativePosition(Sint32 *out_x, Sint32 *out_y);
 
 void service_SDL_events( JE_boolean clear_new );
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/src/mainint.c 
new/opentyrian-2.1.20220318/src/mainint.c
--- old/opentyrian-2.1.20220311/src/mainint.c   2022-03-11 17:52:04.000000000 
+0100
+++ new/opentyrian-2.1.20220318/src/mainint.c   2022-03-18 08:13:57.000000000 
+0100
@@ -1356,6 +1356,8 @@
 
 void JE_doInGameSetup( void )
 {
+       mouseSetRelative(false);
+
        haltGame = false;
 
 #ifdef WITH_NETWORK
@@ -1471,6 +1473,8 @@
        yourInGameMenuRequest = false;
 
        //skipStarShowVGA = true;
+
+       mouseSetRelative(true);
 }
 
 JE_boolean JE_inGameSetup( void )
@@ -3315,6 +3319,8 @@
 
 void JE_pauseGame( void )
 {
+       mouseSetRelative(false);
+
        JE_boolean done = false;
        JE_word mouseX, mouseY;
 
@@ -3408,6 +3414,8 @@
        set_volume(tyrMusicVolume, fxVolume);
 
        //skipStarShowVGA = true;
+
+       mouseSetRelative(true);
 }
 
 void JE_playerMovement( Player *this_player,
@@ -3634,17 +3642,11 @@
                                        button[1] |= mouse_pressed[1];
                                        button[2] |= mouse_has_three_buttons ? 
mouse_pressed[2] : mouse_pressed[1];
 
-                                       if (input_grab_enabled)
-                                       {
-                                               mouseXC += mouse_x - 159;
-                                               mouseYC += mouse_y - 100;
-                                       }
-
-                                       if ((!isNetworkGame || playerNum_ == 
thisPlayerNum)
-                                           && (!galagaMode || (playerNum_ == 2 
|| !twoPlayerMode || player[1].exploding_ticks > 0)))
-                                       {
-                                               set_mouse_position(159, 100);
-                                       }
+                                       Sint32 mouseXR;
+                                       Sint32 mouseYR;
+                                       mouseGetRelativePosition(&mouseXR, 
&mouseYR);
+                                       mouseXC += mouseXR;
+                                       mouseYC += mouseYR;
                                }
 
                                /* keyboard input */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/src/tyrian2.c 
new/opentyrian-2.1.20220318/src/tyrian2.c
--- old/opentyrian-2.1.20220311/src/tyrian2.c   2022-03-11 17:52:04.000000000 
+0100
+++ new/opentyrian-2.1.20220318/src/tyrian2.c   2022-03-18 08:13:57.000000000 
+0100
@@ -641,6 +641,8 @@
 
 start_level:
 
+       mouseSetRelative(false);
+
        if (galagaMode)
                twoPlayerMode = false;
 
@@ -726,6 +728,9 @@
        if (mainLevel == 0)  // if quit itemscreen
                return;          // back to titlescreen
 
+       if (!play_demo)
+               mouseSetRelative(true);
+
        fade_song();
 
        for (uint i = 0; i < COUNTOF(player); ++i)
@@ -2173,7 +2178,6 @@
                                else
                                        JE_dString(VGAScreen, 120, 60, 
miscText[21], FONT_SHAPES); // game over
 
-                               set_mouse_position(159, 100);
                                if (firstGameOver)
                                {
                                        if (!play_demo)
@@ -2225,7 +2229,7 @@
                                goto level_loop;
                }
 
-               if (pause_pressed)
+               if (pause_pressed || !windowHasFocus)
                {
                        pause_pressed = false;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/src/video.c 
new/opentyrian-2.1.20220318/src/video.c
--- old/opentyrian-2.1.20220311/src/video.c     2022-03-11 17:52:04.000000000 
+0100
+++ new/opentyrian-2.1.20220318/src/video.c     2022-03-18 08:13:57.000000000 
+0100
@@ -104,8 +104,6 @@
        init_scaler(scaler);
 
        SDL_ShowWindow(main_window);
-
-       input_grab(input_grab_enabled);
 }
 
 void deinit_video( void )
@@ -399,18 +397,23 @@
        last_output_rect = dst_rect;
 }
 
-/** Converts the given point from the game screen coordinates to the window
- * coordinates, after scaling. */
-void map_screen_to_window_pos( int *const inout_x, int *const inout_y )
+/** Maps a specified point in game screen coordinates to window coordinates. */
+void mapScreenPointToWindow(Sint32 *const inout_x, Sint32 *const inout_y)
 {
        *inout_x = (2 * *inout_x + 1) * last_output_rect.w / (2 * VGAScreen->w) 
+ last_output_rect.x;
        *inout_y = (2 * *inout_y + 1) * last_output_rect.h / (2 * VGAScreen->h) 
+ last_output_rect.y;
 }
 
-/** Converts the given point from window coordinates (after scaling) to game
- * screen coordinates. */
-void map_window_to_screen_pos( int *const inout_x, int *const inout_y )
+/** Maps a specified point in window coordinates to game screen coordinates. */
+void mapWindowPointToScreen(Sint32 *const inout_x, Sint32 *const inout_y)
 {
        *inout_x = (2 * (*inout_x - last_output_rect.x) + 1) * VGAScreen->w / 
(2 * last_output_rect.w);
        *inout_y = (2 * (*inout_y - last_output_rect.y) + 1) * VGAScreen->h / 
(2 * last_output_rect.h);
 }
+
+/** Scales a distance in window coordinates to game screen coordinates. */
+void scaleWindowDistanceToScreen(Sint32 *const inout_x, Sint32 *const inout_y)
+{
+       *inout_x = (2 * *inout_x + 1) * VGAScreen->w / (2 * last_output_rect.w);
+       *inout_y = (2 * *inout_y + 1) * VGAScreen->h / (2 * last_output_rect.h);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opentyrian-2.1.20220311/src/video.h 
new/opentyrian-2.1.20220318/src/video.h
--- old/opentyrian-2.1.20220311/src/video.h     2022-03-11 17:52:04.000000000 
+0100
+++ new/opentyrian-2.1.20220318/src/video.h     2022-03-18 08:13:57.000000000 
+0100
@@ -59,8 +59,9 @@
 void JE_clr256( SDL_Surface * );
 void JE_showVGA( void );
 
-void map_screen_to_window_pos( int *inout_x, int *inout_y);
-void map_window_to_screen_pos( int *inout_x, int *inout_y);
+void mapScreenPointToWindow(Sint32 *inout_x, Sint32 *inout_y);
+void mapWindowPointToScreen(Sint32 *inout_x, Sint32 *inout_y);
+void scaleWindowDistanceToScreen(Sint32 *inout_x, Sint32 *inout_y);
 
 #endif /* VIDEO_H */
 

++++++ opentyrian.obsinfo ++++++
--- /var/tmp/diff_new_pack.op04HB/_old  2022-03-23 20:20:32.998536475 +0100
+++ /var/tmp/diff_new_pack.op04HB/_new  2022-03-23 20:20:33.002536477 +0100
@@ -1,5 +1,5 @@
 name: opentyrian
-version: 2.1.20220311
-mtime: 1647017524
-commit: 425fe65fd9fc15372b6aa3ada42ea8f1e390ec48
+version: 2.1.20220318
+mtime: 1647587637
+commit: 8f205e6b12cb9c34905fa960416b6f661bf38ac3
 

Reply via email to