~jm-leddy/ubuntu/oneiric/unity-2d/unsetenvvariables

« back to all changes in this revision

Viewing changes to panel/applets/appname/windowhelper.cpp

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2011-09-29 16:58:34 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: package-import@ubuntu.com-20110929165834-6rrgqhexh65hopnc
Tags: upstream-4.12.0
ImportĀ upstreamĀ versionĀ 4.12.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <QDateTime>
43
43
#include <QApplication>
44
44
#include <QDesktopWidget>
 
45
#include <QPoint>
 
46
 
 
47
// X11
 
48
#include <X11/Xlib.h>
 
49
#include <X11/Xatom.h>
 
50
#include <QX11Info>
45
51
 
46
52
struct WindowHelperPrivate
47
53
{
157
163
    wnck_window_unmaximize(d->m_window);
158
164
}
159
165
 
 
166
void WindowHelper::drag(const QPoint& pos)
 
167
{
 
168
    // this code IMO should ultimately belong to wnck
 
169
    if (wnck_window_is_maximized(d->m_window)) {
 
170
        XEvent xev;
 
171
        QX11Info info;
 
172
        Atom netMoveResize = XInternAtom(QX11Info::display(), "_NET_WM_MOVERESIZE", false);
 
173
        xev.xclient.type = ClientMessage;
 
174
        xev.xclient.message_type = netMoveResize;
 
175
        xev.xclient.display = QX11Info::display();
 
176
        xev.xclient.window = wnck_window_get_xid(d->m_window);
 
177
        xev.xclient.format = 32;
 
178
        xev.xclient.data.l[0] = pos.x();
 
179
        xev.xclient.data.l[1] = pos.y();
 
180
        xev.xclient.data.l[2] = 8; // _NET_WM_MOVERESIZE_MOVE
 
181
        xev.xclient.data.l[3] = Button1;
 
182
        xev.xclient.data.l[4] = 0;
 
183
        XUngrabPointer(QX11Info::display(), QX11Info::appTime());
 
184
        XSendEvent(QX11Info::display(), QX11Info::appRootWindow(info.screen()), false,
 
185
                   SubstructureRedirectMask | SubstructureNotifyMask, &xev);
 
186
    }
 
187
}
 
188
 
160
189
#include "windowhelper.moc"