summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/beingpopup.cpp2
-rw-r--r--src/gui/chatwindow.cpp13
-rw-r--r--src/gui/viewport.cpp3
-rw-r--r--src/gui/widgets/window.cpp16
-rw-r--r--src/gui/widgets/window.h4
5 files changed, 27 insertions, 11 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index c11937e9..7bf9edac 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -51,6 +51,8 @@ BeingPopup::BeingPopup():
add(mBeingName);
add(mBeingParty);
+
+ addMouseListener(this);
}
BeingPopup::~BeingPopup() = default;
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index a3d9a1f4..0229bf76 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -343,10 +343,17 @@ void ChatWindow::mousePressed(gcn::MouseEvent &event)
if (event.isConsumed())
return;
- mMoved = event.getY() <= getFocused()->getHeight();
- mDragOffsetX = event.getX();
- mDragOffsetY = event.getY();
+ // Enable dragging the chat window also in the tab area, since it doesn't
+ // have much of a title bar.
+ if (!mouseResize)
+ {
+ const int dragHeight = getFocused()->getHeight() +
+ static_cast<int>(getTitleBarHeight());
+ mMoved = event.getY() < dragHeight;
+ mDragOffsetX = event.getX();
+ mDragOffsetY = event.getY();
+ }
}
void ChatWindow::mouseDragged(gcn::MouseEvent &event)
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index f02d2973..0d4af6f8 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -315,9 +315,6 @@ void Viewport::_drawDebugPath(Graphics *graphics)
{
if (mDebugFlags & Map::DEBUG_MOUSE_PATH)
{
- // Get the current mouse position
- SDL_GetMouseState(&mMouseX, &mMouseY);
-
// Prepare the walkmask corresponding to the protocol
unsigned char walkMask;
switch (Net::getNetworkType())
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index e09986d2..25ca7684 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -371,6 +371,8 @@ void Window::mousePressed(gcn::MouseEvent &event)
// Handle window resizing
mouseResize = getResizeHandles(event);
+ if (mouseResize)
+ mMoved = false;
}
}
@@ -405,12 +407,15 @@ void Window::mouseMoved(gcn::MouseEvent &event)
switch (resizeHandles)
{
case BOTTOM | RIGHT:
+ case TOP | LEFT:
gui->setCursorType(Cursor::RESIZE_DOWN_RIGHT);
break;
case BOTTOM | LEFT:
+ case TOP | RIGHT:
gui->setCursorType(Cursor::RESIZE_DOWN_LEFT);
break;
case BOTTOM:
+ case TOP:
gui->setCursorType(Cursor::RESIZE_DOWN);
break;
case RIGHT:
@@ -676,14 +681,17 @@ void Window::adjustPositionAfterResize(int oldScreenWidth, int oldScreenHeight)
int Window::getResizeHandles(gcn::MouseEvent &event)
{
int resizeHandles = 0;
- const int y = event.getY();
- if (mGrip && y > (int) mTitleBarHeight)
+ if (mGrip)
{
const int x = event.getX();
+ const int y = event.getY();
+ const int p = getPadding();
+
+ const bool inPadding = (x < p || x > getWidth() - p) ||
+ (y < p || y > getHeight() - p);
- if (!getChildrenArea().isPointInRect(x, y) &&
- event.getSource() == this)
+ if (inPadding && event.getSource() == this)
{
resizeHandles |= (x > getWidth() - resizeBorderWidth) ? RIGHT :
(x < resizeBorderWidth) ? LEFT : 0;
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index ef529a9f..975de335 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -349,6 +349,9 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
static int getGuiAlpha();
+ protected:
+ static int mouseResize; /**< Active resize handles */
+
private:
enum ResizeHandles
{
@@ -394,7 +397,6 @@ class Window : public gcn::Window, gcn::WidgetListener
int mDefaultWidth; /**< Default window width */
int mDefaultHeight; /**< Default window height */
- static int mouseResize; /**< Active resize handles */
static int instances; /**< Number of Window instances */
Skin *mSkin; /**< Skin in use by this window */