~robert-ancell/unity/ubuntu-session

« back to all changes in this revision

Viewing changes to unity-shared/XWindowManager.cpp

  • Committer: CI bot
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2014-02-14 23:05:22 UTC
  • mfrom: (3656.1.9 decorations-menu)
  • Revision ID: ps-jenkins@lists.canonical.com-20140214230522-piumdig8mkip2h5j
{DecorationsGrabEdge, PanelTitlebarGrabAreaView}: show the WindowAction menu on right-click Fixes: 1098419, 1280042

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
  return GetStringProperty(window_id, XA_WM_NAME);
163
163
}
164
164
 
 
165
void XWindowManager::UnGrabMousePointer(Time timestamp, int button, int x, int y)
 
166
{
 
167
  Display* dpy = nux::GetGraphicsDisplay()->GetX11Display();
 
168
  XUngrabPointer(dpy, CurrentTime);
 
169
  XFlush(dpy);
 
170
 
 
171
  // --------------------------------------------------------------------------
 
172
  // FIXME: This is a workaround until the non-paired events issue is fixed in
 
173
  // nux
 
174
  XButtonEvent bev;
 
175
  memset(&bev, 0, sizeof(bev));
 
176
 
 
177
  bev.type = ButtonRelease;
 
178
  bev.send_event = False;
 
179
  bev.display = dpy;
 
180
  bev.time = timestamp;
 
181
  bev.x = x;
 
182
  bev.y = y;
 
183
  bev.x_root = x;
 
184
  bev.y_root = y;
 
185
  bev.button = button;
 
186
  bev.same_screen = True;
 
187
  nux::GetWindowThread()->ProcessForeignEvent(reinterpret_cast<XEvent*>(&bev), nullptr);
 
188
  // --------------------------------------------------------------------------
 
189
}
 
190
 
165
191
void XWindowManager::StartMove(Window window_id, int x, int y)
166
192
{
167
193
  if (x < 0 || y < 0)
171
197
  Display* d = nux::GetGraphicsDisplay()->GetX11Display();
172
198
 
173
199
  /* We first need to ungrab the pointer. FIXME: Evil */
174
 
 
175
 
  XUngrabPointer(d, CurrentTime);
176
 
 
177
 
  // --------------------------------------------------------------------------
178
 
  // FIXME: This is a workaround until the non-paired events issue is fixed in
179
 
  // nux
180
 
  XButtonEvent bev =
181
 
  {
182
 
    ButtonRelease,
183
 
    0,
184
 
    False,
185
 
    d,
186
 
    0,
187
 
    0,
188
 
    0,
189
 
    CurrentTime,
190
 
    x, y,
191
 
    x, y,
192
 
    0,
193
 
    Button1,
194
 
    True
195
 
  };
196
 
  XEvent* e = (XEvent*)&bev;
197
 
  nux::GetWindowThread()->ProcessForeignEvent(e, NULL);
 
200
  UnGrabMousePointer(CurrentTime, Button1, x, y);
198
201
 
199
202
  ev.xclient.type    = ClientMessage;
200
203
  ev.xclient.display = d;