* fix compilation without scons experimental_wm_api=yes

* Extended the demo with an addional MouseGrab Test
This commit is contained in:
hurikhan 2015-01-22 01:14:50 +09:00
parent 6dd1a21fb7
commit 94d94a0855
4 changed files with 16 additions and 7 deletions

View File

@ -33,7 +33,6 @@ func _fixed_process(delta):
get_node("Label_Screen0_Position").set_text(str("Screen0 Position:\n",OS.get_screen_position() ) )
if(OS.get_screen_count() > 1):
get_node("Button_Screen0").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_Minimized").set_pressed( OS.is_minimized() )
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():
@ -113,4 +113,6 @@ func _on_Button_Maximized_pressed():
OS.set_maximized(true)
func _on_Button_Mouse_Grab_pressed():
var observer = get_node("../Observer")
observer.state = observer.STATE_GRAB

View File

@ -10,3 +10,10 @@ fullscreen=false
resizable=true
width=800
height=600
[input]
move_forward=[key(W)]
move_backwards=[key(S)]
move_left=[key(A)]
move_right=[key(D)]

View File

@ -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->initialize();
if (true) {
rasterizer = memnew( RasterizerGLES2 );
} else {
//rasterizer = memnew( RasterizerGLES1 );
};
rasterizer = memnew( RasterizerGLES2 );
#endif
visual_server = memnew( VisualServerRaster(rasterizer) );
@ -1164,10 +1160,12 @@ void OS_X11::process_xevents() {
case FocusIn:
minimized = false;
#ifdef EXPERIMENTAL_WM_API
if(current_videomode.fullscreen) {
set_wm_fullscreen(true);
visual_server->init();
}
#endif
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
if (mouse_mode==MOUSE_MODE_CAPTURED) {
XGrabPointer(x11_display, x11_window, True,
@ -1178,11 +1176,13 @@ void OS_X11::process_xevents() {
break;
case FocusOut:
#ifdef EXPERIMENTAL_WM_API
if(current_videomode.fullscreen) {
set_wm_fullscreen(false);
set_minimized(true);
visual_server->init();
}
#endif
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
if (mouse_mode==MOUSE_MODE_CAPTURED) {
//dear X11, I try, I really try, but you never work, you do whathever you want.