Skip to content

Commit

Permalink
Merge pull request #41373 from godotengine/revert-38727-tiling-wm-iss…
Browse files Browse the repository at this point in the history
…ues-tests

Revert "Fixes for windows in X11 tiling WMs"
  • Loading branch information
reduz authored Aug 19, 2020
2 parents d3bd84d + 9c5c163 commit 8442515
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 36 deletions.
12 changes: 2 additions & 10 deletions platform/linuxbsd/display_server_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,14 +681,6 @@ DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, u
return id;
}

void DisplayServerX11::show_window(WindowID p_id) {
_THREAD_SAFE_METHOD_

WindowData &wd = windows[p_id];

XMapWindow(x11_display, wd.x11_window);
}

void DisplayServerX11::delete_sub_window(WindowID p_id) {
_THREAD_SAFE_METHOD_

Expand Down Expand Up @@ -3153,6 +3145,8 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
WindowData wd;
wd.x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo->screen), p_rect.position.x, p_rect.position.y, p_rect.size.width > 0 ? p_rect.size.width : 1, p_rect.size.height > 0 ? p_rect.size.height : 1, 0, visualInfo->depth, InputOutput, visualInfo->visual, valuemask, &windowAttributes);

XMapWindow(x11_display, wd.x11_window);

//associate PID
// make PID known to X11
{
Expand Down Expand Up @@ -3322,7 +3316,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
if (cursors[current_cursor] != None) {
XDefineCursor(x11_display, wd.x11_window, cursors[current_cursor]);
}

return id;
}

Expand Down Expand Up @@ -3562,7 +3555,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
window_set_flag(WindowFlags(i), true, main_window);
}
}
show_window(main_window);

//create RenderingDevice if used
#if defined(VULKAN_ENABLED)
Expand Down
1 change: 0 additions & 1 deletion platform/linuxbsd/display_server_x11.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ class DisplayServerX11 : public DisplayServer {
virtual Vector<DisplayServer::WindowID> get_window_list() const;

virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i());
virtual void show_window(WindowID p_id);
virtual void delete_sub_window(WindowID p_id);

virtual WindowID get_window_at_screen_position(const Point2i &p_position) const;
Expand Down
1 change: 0 additions & 1 deletion platform/osx/display_server_osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ class DisplayServerOSX : public DisplayServer {
virtual Vector<int> get_window_list() const override;

virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i()) override;
virtual void show_window(WindowID p_id) override;
virtual void delete_sub_window(WindowID p_id) override;

virtual void window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
Expand Down
11 changes: 3 additions & 8 deletions platform/osx/display_server_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2314,23 +2314,18 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
_THREAD_SAFE_METHOD_

WindowID id = _create_window(p_mode, p_rect);
WindowData &wd = windows[id];
for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
if (p_flags & (1 << i)) {
window_set_flag(WindowFlags(i), true, id);
}
}

return id;
}

void DisplayServerOSX::show_window(WindowID p_id) {
WindowData &wd = windows[p_id];

if (wd.no_focus) {
[wd.window_object orderFront:nil];
} else {
[wd.window_object makeKeyAndOrderFront:nil];
}
return id;
}

void DisplayServerOSX::_send_window_event(const WindowData &wd, WindowEvent p_event) {
Expand Down Expand Up @@ -3779,7 +3774,7 @@ Point2i window_position(
window_set_flag(WindowFlags(i), true, main_window);
}
}
show_window(MAIN_WINDOW_ID);
[windows[main_window].window_object makeKeyAndOrderFront:nil];

#if defined(OPENGL_ENABLED)
if (rendering_driver == "opengl_es") {
Expand Down
16 changes: 7 additions & 9 deletions platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,13 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod

_update_window_style(window_id);

return window_id;
}

void DisplayServerWindows::show_window(WindowID p_id) {
WindowData &wd = windows[p_id];

ShowWindow(wd.hWnd, wd.no_focus ? SW_SHOWNOACTIVATE : SW_SHOW); // Show The Window
if (!wd.no_focus) {
ShowWindow(wd.hWnd, (p_flags & WINDOW_FLAG_NO_FOCUS_BIT) ? SW_SHOWNOACTIVATE : SW_SHOW); // Show The Window
if (!(p_flags & WINDOW_FLAG_NO_FOCUS_BIT)) {
SetForegroundWindow(wd.hWnd); // Slightly Higher Priority
SetFocus(wd.hWnd); // Sets Keyboard Focus To
}

return window_id;
}

void DisplayServerWindows::delete_sub_window(WindowID p_window) {
Expand Down Expand Up @@ -3143,7 +3139,9 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
}
}

show_window(MAIN_WINDOW_ID);
ShowWindow(windows[MAIN_WINDOW_ID].hWnd, SW_SHOW); // Show The Window
SetForegroundWindow(windows[MAIN_WINDOW_ID].hWnd); // Slightly Higher Priority
SetFocus(windows[MAIN_WINDOW_ID].hWnd); // Sets Keyboard Focus To

#if defined(VULKAN_ENABLED)

Expand Down
1 change: 0 additions & 1 deletion platform/windows/display_server_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ class DisplayServerWindows : public DisplayServer {
virtual Vector<DisplayServer::WindowID> get_window_list() const;

virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i());
virtual void show_window(WindowID p_window);
virtual void delete_sub_window(WindowID p_window);

virtual WindowID get_window_at_screen_position(const Point2i &p_position) const;
Expand Down
1 change: 0 additions & 1 deletion scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ void Window::_make_window() {
}

RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE);
DisplayServer::get_singleton()->show_window(window_id);
}

void Window::_update_from_window() {
Expand Down
4 changes: 0 additions & 4 deletions servers/display_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, uint
ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server.");
}

void DisplayServer::show_window(WindowID p_id) {
ERR_FAIL_MSG("Sub-windows not supported by this display server.");
}

void DisplayServer::delete_sub_window(WindowID p_id) {
ERR_FAIL_MSG("Sub-windows not supported by this display server.");
}
Expand Down
1 change: 0 additions & 1 deletion servers/display_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ class DisplayServer : public Object {
};

virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i());
virtual void show_window(WindowID p_id);
virtual void delete_sub_window(WindowID p_id);

virtual WindowID get_window_at_screen_position(const Point2i &p_position) const = 0;
Expand Down

0 comments on commit 8442515

Please sign in to comment.