diff src/video/photon/SDL_ph_mouse.c @ 701:aaf3b8af6616

Date: Sat, 30 Aug 2003 16:28:10 +0300 From: "Mike Gorchak" Subject: Re: SDL 1.2.6 - minor changes about shared library building under QNX6 into README.QNX - added forgotten libSDLmain.a into distribution, SDL.qpg.in - added header guards to the all headers. - fixed fullscreen double buffered mode. - fixed Photon crashes after/during using fullscreen OpenGL modes. - added GL_MakeCurrent function. - added SDL_VIDEOEXPOSE event, when OpenGL window have been resized - added more HAVE_OPENGL checks to avoid dead code compilation without using OpenGL - finished code reorganization (began into previous patches).
author Sam Lantinga <slouken@libsdl.org>
date Sat, 30 Aug 2003 17:07:59 +0000
parents 8bedd6d61642
children b8d311d90021
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_mouse.c	Sat Aug 30 09:09:09 2003 +0000
+++ b/src/video/photon/SDL_ph_mouse.c	Sat Aug 30 17:07:59 2003 +0000
@@ -120,10 +120,10 @@
 
 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
 {
-    return(*cursor->ph_cursor);
+    return (*cursor->ph_cursor);
 }
 
-int ph_ShowWMCursor(_THIS, WMcursor *cursor)
+int ph_ShowWMCursor(_THIS, WMcursor* cursor)
 {
     PtArg_t args[3];
     int nargs = 0;
@@ -137,7 +137,15 @@
     /* looks like photon can't draw mouse cursor in direct mode */
     if ((this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
     {
-        return (0);
+         /* disable the fake mouse in the fullscreen OpenGL mode */
+         if ((this->screen->flags & SDL_OPENGL) == SDL_OPENGL)
+         {
+             cursor=NULL;
+         }
+         else
+         {
+             return (0);
+         }
     }
 
     /* Set the photon cursor, or blank if cursor is NULL */
@@ -167,6 +175,7 @@
     return (1);
 }
 
+
 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
 {
     short abs_x, abs_y;
@@ -190,3 +199,31 @@
         mouse_relative = 0;
     }
 }
+
+
+void ph_UpdateMouse(_THIS)
+{
+    PhCursorInfo_t phcursor;
+    short abs_x;
+    short abs_y;
+
+    /* Lock the event thread, in multi-threading environments */
+    SDL_Lock_EventThread();
+
+    /* synchronizing photon mouse cursor position and SDL mouse position, if cursor appears over window. */
+    PtGetAbsPosition(window, &abs_x, &abs_y);
+    PhQueryCursor(PhInputGroup(NULL), &phcursor);
+    if (((phcursor.pos.x >= abs_x) && (phcursor.pos.x <= abs_x + this->screen->w)) &&
+        ((phcursor.pos.y >= abs_y) && (phcursor.pos.y <= abs_y + this->screen->h)))
+    {
+        SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+        SDL_PrivateMouseMotion(0, 0, phcursor.pos.x-abs_x, phcursor.pos.y-abs_y);
+    }
+    else
+    {
+        SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
+    }
+
+    /* Unlock the event thread, in multi-threading environments */
+    SDL_Unlock_EventThread();
+}