diff src/video/photon/SDL_ph_mouse.c @ 315:3333b6e68289

Date: Sat, 23 Mar 2002 13:53:37 +0200 From: "Mike Gorchak" <mike@malva.ua> Subject: Big QNX patch again. Added 8bit palette emulation code for window mode with bpp>=15. Added store/restore original palette for 8bit modes. Added more information about photon API call fails. Rewroten change palette code, slow but works. Fixed bug with set caption before window was inited. Fixed bugs with some initial state of variables. Fixed bug with storing old video mode settings. Fixed bug with switching to fullscreen mode and back. Fixed few double SEGFAULTS during parachute mode. Removed compilation warning with no PgWaitHWIdle prototype. Removed pack of dead unusable code. Cleanups SDL_PrivateVideoData structure, some headers. Some code formatting.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 Mar 2002 20:19:44 +0000
parents f6ffac90895c
children bce7171e7a85
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_mouse.c	Fri Mar 22 18:11:56 2002 +0000
+++ b/src/video/photon/SDL_ph_mouse.c	Sat Mar 23 20:19:44 2002 +0000
@@ -36,25 +36,25 @@
 #include "SDL_ph_mouse_c.h"
 
 struct  WMcursor {
-	PhCursorDef_t *ph_cursor ;
+    PhCursorDef_t *ph_cursor ;
 };
 
 
 void ph_FreeWMCursor(_THIS, WMcursor *cursor)
 {
+    if (window != NULL)
+    {
+        SDL_Lock_EventThread();
 
-    if ( window != NULL ) {
-		SDL_Lock_EventThread();
-		
-		if (PtSetResource( window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0 ) < 0)
-		{
-			//TODO: output error msg
-		}
-		
-		SDL_Unlock_EventThread();
-	}	
-	//free(cursor->ph_cursor.images);
-	free(cursor);
+        if (PtSetResource( window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0 ) < 0)
+        {
+            /* TODO: output error msg */
+        }
+
+        SDL_Unlock_EventThread();
+    }	
+    /* free(cursor->ph_cursor.images); */
+    free(cursor);
 }
 
 WMcursor *ph_CreateWMCursor(_THIS,
@@ -120,7 +120,7 @@
 
 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
 {
-	return(*cursor->ph_cursor);
+    return(*cursor->ph_cursor);
 }
 
 int ph_ShowWMCursor(_THIS, WMcursor *cursor)
@@ -170,22 +170,24 @@
 
 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
 {
-	short abs_x, abs_y;
+    short abs_x, abs_y;
 
-	SDL_Lock_EventThread();
-	PtGetAbsPosition( window, &abs_x, &abs_y );
-	PhMoveCursorAbs( PhInputGroup(NULL), x + abs_x, y + abs_y );
-	SDL_Unlock_EventThread();
+    SDL_Lock_EventThread();
+    PtGetAbsPosition( window, &abs_x, &abs_y );
+    PhMoveCursorAbs( PhInputGroup(NULL), x + abs_x, y + abs_y );
+    SDL_Unlock_EventThread();
 }
 
 
 void ph_CheckMouseMode(_THIS)
 {
-        /* If the mouse is hidden and input is grabbed, we use relative mode */
-        if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
-             (this->input_grab != SDL_GRAB_OFF) ) {
-                mouse_relative = 1;
-        } else {
-                mouse_relative = 0;
-        }
+    /* If the mouse is hidden and input is grabbed, we use relative mode */
+    if ( !(SDL_cursorstate & CURSOR_VISIBLE) && (this->input_grab != SDL_GRAB_OFF))
+    {
+        mouse_relative = 1;
+    }
+    else
+    {
+        mouse_relative = 0;
+    }
 }