mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
generic: adjust to KSelectionOwner changes
had to rewrite KSelectionOwner to fix the issues with it Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4a3e652e5a
commit
10032daa02
4 changed files with 8 additions and 66 deletions
|
@ -43,7 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <klocale.h>
|
||||
#include <kglobal.h>
|
||||
#include <kconfig.h>
|
||||
#include <kmanagerselection.h>
|
||||
#include <kselectionowner.h>
|
||||
#include <kwindowsystem.h>
|
||||
#include <QtGui/qx11info_x11.h>
|
||||
#include <QtCore/qfile.h>
|
||||
|
|
|
@ -51,7 +51,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KGlobal>
|
||||
#include <KLocalizedString>
|
||||
#include <KNotification>
|
||||
#include <KSelectionWatcher>
|
||||
|
||||
#include <xcb/composite.h>
|
||||
#include <xcb/damage.h>
|
||||
|
|
|
@ -92,58 +92,15 @@ bool initting = false;
|
|||
*/
|
||||
static bool kwin_sync = false;
|
||||
|
||||
//************************************
|
||||
// KWinSelectionOwner
|
||||
//************************************
|
||||
|
||||
KWinSelectionOwner::KWinSelectionOwner(int screen_P, QObject *parent)
|
||||
: KSelectionOwner(make_selection_atom(screen_P), screen_P, parent)
|
||||
{
|
||||
}
|
||||
|
||||
Atom KWinSelectionOwner::make_selection_atom(int screen_P)
|
||||
static QByteArray make_selection_atom(int screen_P)
|
||||
{
|
||||
if (screen_P < 0)
|
||||
screen_P = DefaultScreen(display());
|
||||
char tmp[ 30 ];
|
||||
sprintf(tmp, "WM_S%d", screen_P);
|
||||
return XInternAtom(display(), tmp, False);
|
||||
return QByteArray(tmp);
|
||||
}
|
||||
|
||||
void KWinSelectionOwner::getAtoms()
|
||||
{
|
||||
KSelectionOwner::getAtoms();
|
||||
if (xa_version == None) {
|
||||
Atom atoms[ 1 ];
|
||||
const char* const names[] =
|
||||
{ "VERSION" };
|
||||
XInternAtoms(display(), const_cast< char** >(names), 1, False, atoms);
|
||||
xa_version = atoms[ 0 ];
|
||||
}
|
||||
}
|
||||
|
||||
void KWinSelectionOwner::replyTargets(Atom property_P, Window requestor_P)
|
||||
{
|
||||
KSelectionOwner::replyTargets(property_P, requestor_P);
|
||||
Atom atoms[ 1 ] = { xa_version };
|
||||
// PropModeAppend !
|
||||
XChangeProperty(display(), requestor_P, property_P, XA_ATOM, 32, PropModeAppend,
|
||||
reinterpret_cast< unsigned char* >(atoms), 1);
|
||||
}
|
||||
|
||||
bool KWinSelectionOwner::genericReply(Atom target_P, Atom property_P, Window requestor_P)
|
||||
{
|
||||
if (target_P == xa_version) {
|
||||
long version[] = { 2, 0 };
|
||||
XChangeProperty(display(), requestor_P, property_P, XA_INTEGER, 32,
|
||||
PropModeReplace, reinterpret_cast< unsigned char* >(&version), 2);
|
||||
return true;
|
||||
}
|
||||
return KSelectionOwner::genericReply(target_P, property_P, requestor_P);
|
||||
}
|
||||
|
||||
Atom KWinSelectionOwner::xa_version = None;
|
||||
|
||||
// errorMessage is only used ifndef NDEBUG, and only in one place.
|
||||
// it might be worth reevaluating why this is used? I don't know.
|
||||
#ifndef NDEBUG
|
||||
|
@ -297,7 +254,7 @@ int Application::crashes = 0;
|
|||
|
||||
Application::Application()
|
||||
: KApplication()
|
||||
, owner(new KWinSelectionOwner(screen_number, this))
|
||||
, owner(new KSelectionOwner(make_selection_atom(screen_number), screen_number, this))
|
||||
{
|
||||
if (KCmdLineArgs::parsedArgs("qt")->isSet("sync")) {
|
||||
kwin_sync = true;
|
||||
|
@ -316,7 +273,7 @@ Application::Application()
|
|||
if (screen_number == -1)
|
||||
screen_number = DefaultScreen(display());
|
||||
|
||||
if (!owner->claim(args->isSet("replace"), true)) {
|
||||
if (!owner->claim(args->isSet("replace"))) {
|
||||
fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit(), stderr);
|
||||
::exit(1);
|
||||
}
|
||||
|
@ -387,6 +344,7 @@ Application::~Application()
|
|||
XSetInputFocus(display(), PointerRoot, RevertToPointerRoot, xTime());
|
||||
}
|
||||
owner->release();
|
||||
delete owner;
|
||||
delete options;
|
||||
delete effects;
|
||||
delete atoms;
|
||||
|
|
19
kwin/main.h
19
kwin/main.h
|
@ -23,26 +23,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define MAIN_H
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <KSelectionWatcher>
|
||||
#include <KSelectionOwner>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class KWinSelectionOwner
|
||||
: public KSelectionOwner
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KWinSelectionOwner(int screen, QObject *parent);
|
||||
protected:
|
||||
virtual bool genericReply(Atom target, Atom property, Window requestor);
|
||||
virtual void replyTargets(Atom property, Window requestor);
|
||||
virtual void getAtoms();
|
||||
private:
|
||||
Atom make_selection_atom(int screen);
|
||||
static Atom xa_version;
|
||||
};
|
||||
|
||||
class Application : public KApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -60,7 +45,7 @@ private slots:
|
|||
void resetCrashesCount();
|
||||
|
||||
private:
|
||||
KWinSelectionOwner* owner;
|
||||
KSelectionOwner* owner;
|
||||
static int crashes;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue