Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11 window management #1487

Merged
merged 49 commits into from
Mar 22, 2015
Merged

Conversation

hurikhan
Copy link
Contributor

@hurikhan hurikhan commented Mar 8, 2015

This PR will add the following methods to the OS singleton like discussed in the developers mailing list:

Screen:

  • int OS.get_screen_count()
  • int OS.get_screen()
  • void OS.set_screen(int screen)
  • Vector2 OS.get_screen_position(int screen=0)
  • Vector2 OS.get_screen_size(int screen=0)

Window positioning and sizing:

  • Vector2 OS.get_window_position()
  • void OS.set_window_position(Vector2 position)
  • Vector2 OS.get_window_size()
  • void OS.set_window_size(Vector2 size)

Window states:

  • void OS.set_fullscreen(bool enabled)
  • bool OS.is_fullscreen()
  • void OS.set_maximized(bool enabled)
  • bool OS.is_maximized()
  • void OS.set_minimized(bool enabled)
  • bool OS.is_minimized()
  • void OS.set_resizable(bool enabled)
  • bool OS.is_resizeable()

Compiling

scons p=x11 new_wm_api=yes

Demo

The PR also includes the window_management demo. It can be used as test case for the different x11 desktop environments and also as an implementation test for other platforms(OSX + Windows):
window_management_demo

If some methods are not implemented, the demo will show a warning on startup:
window_management_demo_missing_methods

Note

This PR will only work on the x11 platform(Linux). When you try to compile it on other platforms, compilation will stop with an error. Hopefully this will change in the future. It is just a starting point for a new wm api.

Linux/X11 folks, please test^3 it =)

hurikhan added 30 commits January 10, 2015 15:47
================================================

Usage:
    scons p=x11 experimental_wm_api=yes
 * set_minimized(bool)
 * bool is_minimized()
 * set_maximized(bool)
 * bool is_maximized()
@adolson
Copy link
Contributor

adolson commented Mar 8, 2015

I tested this previously, and it worked perfectly. Debian and GNOME.

@theuserbl
Copy link
Contributor

Don't work on OpenSuse 13.1 with nouveau driver:
http://fs2.directupload.net/images/150308/a3n27umj.png

I have used your latest trunk:
svn co https://github.com/hurikhan/godot

Compiled with
scons p=x11 new_vm_api=yes

Running direct from the project manager gives out this from the console:

theuserbl@linux-faoz:~/godot/hurikhan/godot/trunk/bin> ./godot.x11.tools.64
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/bin/godot.x11.tools.64, -1, -1
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/bin/data.pck, -1, -1
ERROR: _decode_variant: Condition ' params.size()!=5 ' is true. returned: Image()
At: core/io/config_file.cpp:542.
ERROR: _load_recent_projects: Condition ' err!=OK ' is true. Continuing..:
At: tools/editor/project_manager.cpp:523.
OPENING: /home/theuserbl/godot/hurikhan/godot/trunk/demos/misc/window_management (::home::theuserbl::godot::hurikhan::godot::trunk::demos::misc::window_management)
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/bin/godot.x11.tools.64, -1, -1
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/demos/misc/window_management/data.pck, -1, -1
7
3
1
1
5
7
7
6
2
2
3
7
7
5
4
4
6
7
2
6
4
4
0
2
4
5
1
1
0
4
1
3
2
2
0
1
ERROR: fixed_material_set_parameter: fmp_emission expects Color
At: servers/visual/rasterizer.cpp:392.
ERROR: _fixed_process: Invalid call. Unexisting function 'is_fullscreen' in base '_OS'.
At: res://control.gd:5.
ERROR: _fixed_process: Invalid call. Unexisting function 'is_fullscreen' in base '_OS'.
At: res://control.gd:5.
base resources missing 1
ERROR: finish: Condition ' instance_dependency_map.size() ' is true.

At: servers/visual/visual_server_raster.cpp:6757.

Load it in the editor and start it from there, gives out the following in the console:

theuserbl@linux-faoz:/godot/hurikhan/godot/trunk/bin> ./godot.x11.tools.64
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/bin/godot.x11.tools.64, -1, -1
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/bin/data.pck, -1, -1
ERROR: _decode_variant: Condition ' params.size()!=5 ' is true. returned: Image()
At: core/io/config_file.cpp:542.
ERROR: _load_recent_projects: Condition ' err!=OK ' is true. Continuing..:
At: tools/editor/project_manager.cpp:523.
OPENING: /home/theuserbl/godot/hurikhan/godot/trunk/demos/misc/window_management (::home::theuserbl::godot::hurikhan::godot::trunk::demos::misc::window_management)
theuserbl@linux-faoz:
/godot/hurikhan/godot/trunk/bin> REQUEST time to 1
PLUGIN INIT
7
3
1
1
5
7
7
6
2
2
3
7
7
5
4
4
6
7
2
6
4
4
0
2
4
5
1
1
0
4
1
3
2
2
0
1
ERROR: fixed_material_set_parameter: fmp_emission expects Color
At: servers/visual/rasterizer.cpp:392.
attempt set state: (current:0), (sources:res://control.gd)
applying code
applying code
UPDATING: res://control.gd
running: /home/theuserbl/godot/hurikhan/godot/trunk/bin/godot.x11.tools.64 -path /home/theuserbl/godot/hurikhan/godot/trunk/demos/misc/window_management -rdebug localhost:6007 res://window_management.scn
ERROR: set_stream_peer: Condition ' p_peer.is_null() ' is true.
At: core/io/packet_peer.cpp:228.
********* listening on port 6007
OK! 8
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/bin/godot.x11.tools.64, -1, -1
opening pack /home/theuserbl/godot/hurikhan/godot/trunk/demos/misc/window_management/data.pck, -1, -1
has connection!
has connection!
7
3
1
1
5
7
7
6
2
2
3
7
7
5
4
4
6
7
2
6
4
4
0
2
4
5
1
1
0
4
1
3
2
2
0
1
ERROR: fixed_material_set_parameter: fmp_emission expects Color

At: servers/visual/rasterizer.cpp:392.

Hope it helps

@hurikhan
Copy link
Contributor Author

hurikhan commented Mar 8, 2015

Please try again with:
scons p=x11 new_wm_api=yes

new_wm_api <-- the wm stands for window management.

Thanks for testing :)

@hurikhan
Copy link
Contributor Author

hurikhan commented Mar 8, 2015

It also looks like, if you have compiled my master branch.
The master branch was not merged with the x11-window-management branch.
git checkout x11-window-management <-- will give you the correct branch in the cloned directory

@theuserbl
Copy link
Contributor

Hmm.. now redownloaded with
svn co https://github.com/hurikhan/godot
and recompiled with
scons p=x11 new_wm_api=yes

But the result is the same.

What me wonder is: Your fork is a fork of an old godot with the old version 1.0 skin. But on your screenshots you have the new skin.
Is the version at https://github.com/hurikhan/godot the right one?

@hurikhan
Copy link
Contributor Author

hurikhan commented Mar 8, 2015

svn co https://github.com/hurikhan/godot <-- will always pull the master (i just merged for you, download again)

But i think you should use git on github in the future.

@theuserbl
Copy link
Contributor

Thanks.
But I have now downloaded the zip-file from
https://github.com/hurikhan/godot/tree/x11-window-management

Now all works:
http://fs1.directupload.net/images/150308/edex897f.png

Ok, the OpenGL part looks different from yours. But I think that is the nouveau driver.

Btw: If you have x11-development experience, could you fix the bug at
#1338
I have seen - but currently not written there - that [Ctrl]+[C] works on Windows correct, but on Linux not.

@theuserbl
Copy link
Contributor

Oh, there is NOT a driver problem in this case.
I have a 3D cube, too:
http://fs2.directupload.net/images/150308/b9xdyzxe.png

@theuserbl
Copy link
Contributor

Aaaarghh...
There is a problem with the window_management program in your godot fork.
If you select the buttons ("Fullscreen", "FixedSize", "Minimized", etc) with the mouse, then all is ok.
But if you clicked one and go then with the arrow keys the buttons up and down, then sometimes the window goes to fullscreen and normal size, but you are not over the "Fullscreen"-button.
I have also done it in the "MouseGrab"-mode. And after some time, my computer becomes a memory problem, the system is frozen and I should rebooting it.

were used before for fast multiscreen setup testing.
@hurikhan
Copy link
Contributor Author

hurikhan commented Mar 8, 2015

These keys were used before for fast multiscreen-testing:

up = fullscreen
down = normalize
left = screen 0
right = screen 1

I removed them all from the demo.

Maybe the right key lets crash your computer, in the case you have an single-screen setup.

@theuserbl
Copy link
Contributor

Thanks. Now it works perfect.

Maybe the right key lets crash your computer, in the case you have an single-screen setup.

No, it was more the "up" and "down". I think godot have had problems with it, that the keys are defined with two different functions: toggle fullscreen AND navigating through the buttons.

Hopefully your functions will be in the near future added for Mac and Win, too.

@MarianoGnu
Copy link
Contributor

get_screen_size() should return a Size2 instead of Vector2

@hurikhan
Copy link
Contributor Author

hurikhan commented Mar 8, 2015

This is correct. Please have a look, how it is implemented on the C++ side. The listing above shows the gdscript side.

reduz added a commit that referenced this pull request Mar 22, 2015
@reduz reduz merged commit 15bee51 into godotengine:master Mar 22, 2015
@reduz
Copy link
Member

reduz commented Mar 22, 2015

time to implement it on windows...

@godotengine
Copy link
Collaborator

OK, This is now working on Windows and OSX!

On Sun, Mar 22, 2015 at 3:11 PM, Juan Linietsky notifications@github.com
wrote:

time to implement it on windows...


Reply to this email directly or view it on GitHub
#1487 (comment).

OkamStudio

@hurikhan
Copy link
Contributor Author

hurikhan commented Apr 3, 2015

awesome =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants