summaryrefslogtreecommitdiff
path: root/src/ui/ui_main.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 11:59:51 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:35 +0000
commit8e412322448053080c00a67f92fda4de183df7fa (patch)
tree007c8e8ba9c6bc39869bd2a3c433bc53e0f7e6d1 /src/ui/ui_main.c
parente28bdd7b296c0028aaa63ee1feb027c2f0ebde51 (diff)
* Merge ioq3-r1464
* Use WM cursor when running windowed and UI module has input
Diffstat (limited to 'src/ui/ui_main.c')
-rw-r--r--src/ui/ui_main.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index d19d5824..304222af 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -139,6 +139,8 @@ void UI_Init( qboolean );
void UI_Shutdown( void );
void UI_KeyEvent( int key, qboolean down );
void UI_MouseEvent( int dx, int dy );
+int UI_MousePosition( void );
+void UI_SetMousePosition( int x, int y );
void UI_Refresh( int realtime );
qboolean UI_IsFullscreen( void );
void UI_SetActiveMenu( uiMenuCommand_t menu );
@@ -167,6 +169,13 @@ intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3,
UI_MouseEvent( arg0, arg1 );
return 0;
+ case UI_MOUSE_POSITION:
+ return UI_MousePosition( );
+
+ case UI_SET_MOUSE_POSITION:
+ UI_SetMousePosition( arg0, arg1 );
+ return 0;
+
case UI_REFRESH:
UI_Refresh( arg0 );
return 0;
@@ -4014,7 +4023,32 @@ void UI_MouseEvent( int dx, int dy )
else if( uiInfo.uiDC.cursory > SCREEN_HEIGHT )
uiInfo.uiDC.cursory = SCREEN_HEIGHT;
- if( Menu_Count() > 0 )
+ if( Menu_Count( ) > 0 )
+ Display_MouseMove( NULL, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory );
+}
+
+/*
+=================
+UI_MousePosition
+=================
+*/
+int UI_MousePosition( void )
+{
+ return (int)rint( uiInfo.uiDC.cursorx ) |
+ (int)rint( uiInfo.uiDC.cursory ) << 16;
+}
+
+/*
+=================
+UI_SetMousePosition
+=================
+*/
+void UI_SetMousePosition( int x, int y )
+{
+ uiInfo.uiDC.cursorx = x;
+ uiInfo.uiDC.cursory = y;
+
+ if( Menu_Count( ) > 0 )
Display_MouseMove( NULL, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory );
}