diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-01-19 11:07:19 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-01-19 11:07:19 +0000 |
| commit | 7c3e4b7040cf21a11b259571c676e4fc244367ad (patch) | |
| tree | da4cddb864a9c2e265aa4f6643a30926ca1dbb02 | |
| parent | 3db1cecdf8a374cd3755757349af31eae9bad169 (diff) | |
| download | qmmp-7c3e4b7040cf21a11b259571c676e4fc244367ad.tar.gz qmmp-7c3e4b7040cf21a11b259571c676e4fc244367ad.tar.bz2 qmmp-7c3e4b7040cf21a11b259571c676e4fc244367ad.zip | |
fixed playlist resize on RTL locales
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3174 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/plugins/Ui/skinned/playlist.cpp | 5 | ||||
| -rw-r--r-- | src/plugins/Ui/skinned/playlisttitlebar.cpp | 12 | ||||
| -rw-r--r-- | src/plugins/Ui/skinned/windowsystem.cpp | 20 | ||||
| -rw-r--r-- | src/plugins/Ui/skinned/windowsystem.h | 3 |
4 files changed, 34 insertions, 6 deletions
diff --git a/src/plugins/Ui/skinned/playlist.cpp b/src/plugins/Ui/skinned/playlist.cpp index 86d22cf34..9df2e1eba 100644 --- a/src/plugins/Ui/skinned/playlist.cpp +++ b/src/plugins/Ui/skinned/playlist.cpp @@ -390,6 +390,11 @@ void PlayList::mouseMoveEvent (QMouseEvent *e) sy--; resize (275+25*sx,116+29*sy); #else +#ifdef Q_WS_X11 + //avoid right corner moving during resize + if(layoutDirection() == Qt::RightToLeft) + WindowSystem::revertGravity(winId()); +#endif resize (e->x() +25, e->y() +25); #endif } diff --git a/src/plugins/Ui/skinned/playlisttitlebar.cpp b/src/plugins/Ui/skinned/playlisttitlebar.cpp index 6d5814ad9..707d87aa1 100644 --- a/src/plugins/Ui/skinned/playlisttitlebar.cpp +++ b/src/plugins/Ui/skinned/playlisttitlebar.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2012 by Ilya Kotov * + * Copyright (C) 2007-2013 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -24,6 +24,7 @@ #include <QApplication> #include <qmmpui/playlistmodel.h> #include "dock.h" +#include "windowsystem.h" #include "button.h" #include "playlisttitlebar.h" #include "skin.h" @@ -177,10 +178,14 @@ void PlayListTitleBar::mouseReleaseEvent(QMouseEvent*) void PlayListTitleBar::mouseMoveEvent(QMouseEvent* event) { - QPoint npos = (event->globalPos()-pos); - QPoint oldpos = npos; + QPoint npos = event->globalPos()-pos; if (m_shaded && m_resize) { +#ifdef Q_WS_X11 + //avoid right corner moving during resize + if(layoutDirection() == Qt::RightToLeft) + WindowSystem::revertGravity(m_pl->winId()); +#endif resize((event->x() + 25*m_ratio), height()); m_pl->resize((event->x() + 25*m_ratio), m_pl->height()); } @@ -194,7 +199,6 @@ void PlayListTitleBar::setActive(bool a) updatePixmap(); } - void PlayListTitleBar::setModel(PlayListModel *selected, PlayListModel *previous) { if(previous) diff --git a/src/plugins/Ui/skinned/windowsystem.cpp b/src/plugins/Ui/skinned/windowsystem.cpp index 75a95eca9..4738f6f5f 100644 --- a/src/plugins/Ui/skinned/windowsystem.cpp +++ b/src/plugins/Ui/skinned/windowsystem.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * Based on Licq * * Copyright (C) 2006-2009 Licq developers * - * Copyright (C) 2011 Ilya Kotov * + * Copyright (C) 2011-2013 Ilya Kotov * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -209,5 +209,23 @@ unsigned char* WindowSystem::getWindowProperty(WId win, const char* prop) return retValue; } +//On RTL locales Qt sets flag NorthEastGravity for windows. +//This function reverts these changes. +void WindowSystem::revertGravity(WId win) +{ + Display* dsp = QX11Info::display(); + XSizeHints sh; + memset(&sh, 0, sizeof(sh)); + long unused; + XGetWMNormalHints(dsp, win, &sh, &unused); + sh.flags |= PWinGravity; + + if(sh.win_gravity == NorthEastGravity) + sh.win_gravity = NorthWestGravity; + else + return; + sh.win_gravity = NorthWestGravity; + XSetWMNormalHints(dsp, win, &sh); +} #endif diff --git a/src/plugins/Ui/skinned/windowsystem.h b/src/plugins/Ui/skinned/windowsystem.h index 0d39e8c47..b5cc76626 100644 --- a/src/plugins/Ui/skinned/windowsystem.h +++ b/src/plugins/Ui/skinned/windowsystem.h @@ -1,7 +1,7 @@ /*************************************************************************** * Based on Licq * * Copyright (C) 2006-2009 Licq developers * - * Copyright (C) 2011 Ilya Kotov * + * Copyright (C) 2011-2013 Ilya Kotov * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -32,6 +32,7 @@ public: static QString netWindowManagerName(); static void changeWinSticky(WId win, bool stick); static void setWinHint(WId win, const char *res_name, const char *res_class); + static void revertGravity(WId win); private: static unsigned char* getWindowProperty(WId win, const char* prop); #endif |
