← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/remove_alt_panning_of_window into lp:widelands

 

SirVer has proposed merging lp:~widelands-dev/widelands/remove_alt_panning_of_window into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/remove_alt_panning_of_window/+merge/242560

Removes alt dragging of windows since it never worked properly in the editor.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/remove_alt_panning_of_window into lp:widelands.
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc	2014-10-28 12:53:29 +0000
+++ src/ui_basic/panel.cc	2014-11-22 10:52:38 +0000
@@ -735,18 +735,6 @@
 	return draw_tooltip(rt, tooltip());
 }
 
-
-/**
- * Called whenever the user presses a mouse button in the panel while pressing the alt-key.
- * This function is called first on the parent panels.
- * It should be only overwritten by the UI::Window class.
- * \return true if the click was processed, false otherwise
- */
-bool Panel::handle_alt_drag(int32_t /* x */, int32_t /* y */)
-{
-	return false;
-}
-
 /**
  * Enable/Disable mouse handling by this panel
  * Default is enabled. Note that when mouse handling is disabled, child panels
@@ -1025,17 +1013,6 @@
 	if (_flags & pf_top_on_click)
 		move_to_top();
 
-	//  TODO(unknown): This code is erroneous. It checks the current key state. What it
-	//  needs is the key state at the time the mouse was clicked. See the
-	//  usage comment for get_key_state.
-	//  Some window managers use alt-drag, so we can't only use the alt keys
-	if
-		((!_g_mousegrab) && (btn == SDL_BUTTON_LEFT) &&
-		 ((get_key_state(SDL_SCANCODE_LALT) | get_key_state(SDL_SCANCODE_RALT) |
-			get_key_state(SDL_SCANCODE_MODE) | get_key_state(SDL_SCANCODE_LSHIFT))))
-		if (handle_alt_drag(x, y))
-			return true;
-
 	if (_g_mousegrab != this)
 		for
 			(Panel * child = _fchild;

=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h	2014-10-27 08:37:54 +0000
+++ src/ui_basic/panel.h	2014-11-22 10:52:38 +0000
@@ -191,7 +191,6 @@
 	virtual bool handle_mousewheel(uint32_t which, int32_t x, int32_t y);
 	virtual bool handle_key(bool down, SDL_Keysym);
 	virtual bool handle_textinput(const char* text);
-	virtual bool handle_alt_drag(int32_t x, int32_t y);
 	virtual bool handle_tooltip();
 
 	/// \returns whether a certain given is currently down.

=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc	2014-11-02 20:31:40 +0000
+++ src/ui_basic/window.cc	2014-11-22 10:52:38 +0000
@@ -464,17 +464,6 @@
 	return true;
 }
 
-bool Window::handle_alt_drag(int32_t mx, int32_t my)
-{
-	_dragging = true;
-	_drag_start_win_x = get_x();
-	_drag_start_win_y = get_y();
-	_drag_start_mouse_x = get_x() + get_lborder() + mx;
-	_drag_start_mouse_y = get_y() + get_tborder() + my;
-	grab_mouse(true);
-	return true;
-}
-
 // Always consume the tooltip event to prevent tooltips from
 // our parent to be rendered
 bool Window::handle_tooltip()

=== modified file 'src/ui_basic/window.h'
--- src/ui_basic/window.h	2014-07-26 10:43:23 +0000
+++ src/ui_basic/window.h	2014-11-22 10:52:38 +0000
@@ -86,7 +86,6 @@
 	bool handle_mouserelease(uint8_t btn, int32_t mx, int32_t my) override;
 	bool handle_mousemove
 		(uint8_t state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
-	bool handle_alt_drag (int32_t mx, int32_t my) override;
 	bool handle_tooltip() override;
 
 protected:


Follow ups