* fix compilation without scons experimental_wm_api=yes
* Extended the demo with an addional MouseGrab Test
This commit is contained in:
parent
6dd1a21fb7
commit
94d94a0855
@ -33,7 +33,6 @@ func _fixed_process(delta):
|
|||||||
|
|
||||||
get_node("Label_Screen0_Position").set_text(str("Screen0 Position:\n",OS.get_screen_position() ) )
|
get_node("Label_Screen0_Position").set_text(str("Screen0 Position:\n",OS.get_screen_position() ) )
|
||||||
|
|
||||||
|
|
||||||
if(OS.get_screen_count() > 1):
|
if(OS.get_screen_count() > 1):
|
||||||
get_node("Button_Screen0").show()
|
get_node("Button_Screen0").show()
|
||||||
get_node("Button_Screen1").show()
|
get_node("Button_Screen1").show()
|
||||||
@ -63,6 +62,7 @@ func _fixed_process(delta):
|
|||||||
get_node("Button_FixedSize").set_pressed( !OS.is_resizable() )
|
get_node("Button_FixedSize").set_pressed( !OS.is_resizable() )
|
||||||
get_node("Button_Minimized").set_pressed( OS.is_minimized() )
|
get_node("Button_Minimized").set_pressed( OS.is_minimized() )
|
||||||
get_node("Button_Maximized").set_pressed( OS.is_maximized() )
|
get_node("Button_Maximized").set_pressed( OS.is_maximized() )
|
||||||
|
get_node("Button_Mouse_Grab").set_pressed( Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED )
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -113,4 +113,6 @@ func _on_Button_Maximized_pressed():
|
|||||||
OS.set_maximized(true)
|
OS.set_maximized(true)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Button_Mouse_Grab_pressed():
|
||||||
|
var observer = get_node("../Observer")
|
||||||
|
observer.state = observer.STATE_GRAB
|
||||||
|
@ -10,3 +10,10 @@ fullscreen=false
|
|||||||
resizable=true
|
resizable=true
|
||||||
width=800
|
width=800
|
||||||
height=600
|
height=600
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
move_forward=[key(W)]
|
||||||
|
move_backwards=[key(S)]
|
||||||
|
move_left=[key(A)]
|
||||||
|
move_right=[key(D)]
|
||||||
|
Binary file not shown.
@ -177,11 +177,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||||||
context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, false ) );
|
context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, false ) );
|
||||||
context_gl->initialize();
|
context_gl->initialize();
|
||||||
|
|
||||||
if (true) {
|
rasterizer = memnew( RasterizerGLES2 );
|
||||||
rasterizer = memnew( RasterizerGLES2 );
|
|
||||||
} else {
|
|
||||||
//rasterizer = memnew( RasterizerGLES1 );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
visual_server = memnew( VisualServerRaster(rasterizer) );
|
visual_server = memnew( VisualServerRaster(rasterizer) );
|
||||||
@ -1164,10 +1160,12 @@ void OS_X11::process_xevents() {
|
|||||||
|
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
minimized = false;
|
minimized = false;
|
||||||
|
#ifdef EXPERIMENTAL_WM_API
|
||||||
if(current_videomode.fullscreen) {
|
if(current_videomode.fullscreen) {
|
||||||
set_wm_fullscreen(true);
|
set_wm_fullscreen(true);
|
||||||
visual_server->init();
|
visual_server->init();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
|
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
|
||||||
if (mouse_mode==MOUSE_MODE_CAPTURED) {
|
if (mouse_mode==MOUSE_MODE_CAPTURED) {
|
||||||
XGrabPointer(x11_display, x11_window, True,
|
XGrabPointer(x11_display, x11_window, True,
|
||||||
@ -1178,11 +1176,13 @@ void OS_X11::process_xevents() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
|
#ifdef EXPERIMENTAL_WM_API
|
||||||
if(current_videomode.fullscreen) {
|
if(current_videomode.fullscreen) {
|
||||||
set_wm_fullscreen(false);
|
set_wm_fullscreen(false);
|
||||||
set_minimized(true);
|
set_minimized(true);
|
||||||
visual_server->init();
|
visual_server->init();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
|
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
|
||||||
if (mouse_mode==MOUSE_MODE_CAPTURED) {
|
if (mouse_mode==MOUSE_MODE_CAPTURED) {
|
||||||
//dear X11, I try, I really try, but you never work, you do whathever you want.
|
//dear X11, I try, I really try, but you never work, you do whathever you want.
|
||||||
|
Loading…
Reference in New Issue
Block a user