Commit fb28d3c5 by Corentin Wallez

X11Window: handling of ConfigureNotify, work when reparented

BUG=angleproject:892 Change-Id: Ib201a5fbf4fca39c90464ed76434dac5e5ded381 Reviewed-on: https://chromium-review.googlesource.com/272683Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 80a50949
...@@ -58,7 +58,7 @@ static void PrintEvent(const Event& event) ...@@ -58,7 +58,7 @@ static void PrintEvent(const Event& event)
case Event::EVENT_GAINED_FOCUS: case Event::EVENT_GAINED_FOCUS:
std::cout << "Event: Window Gained Focus" << std::endl; std::cout << "Event: Window Gained Focus" << std::endl;
break; break;
case Event::TEXT_ENTERED: case Event::EVENT_TEXT_ENTERED:
// TODO(cwallez) show the character // TODO(cwallez) show the character
std::cout << "Event: Text Entered" << std::endl; std::cout << "Event: Text Entered" << std::endl;
break; break;
......
...@@ -336,11 +336,25 @@ void X11Window::processEvent(const XEvent &xEvent) ...@@ -336,11 +336,25 @@ void X11Window::processEvent(const XEvent &xEvent)
} }
if (xEvent.xconfigure.x != mX || xEvent.xconfigure.y != mY) if (xEvent.xconfigure.x != mX || xEvent.xconfigure.y != mY)
{ {
Event event; // Sometimes, the window manager reparents our window (for example
event.Type = Event::EVENT_MOVED; // when resizing) then the X and Y coordinates will be with respect to
event.Move.X = xEvent.xconfigure.x; // the new parent and not what the user wants to know. Use
event.Move.Y = xEvent.xconfigure.y; // XTranslateCoordinates to get the coordinates on the screen.
pushEvent(event); int screen = DefaultScreen(mDisplay);
Window root = RootWindow(mDisplay, screen);
int x, y;
Window child;
XTranslateCoordinates(mDisplay, mWindow, root, 0, 0, &x, &y, &child);
if (x != mX || y != mY)
{
Event event;
event.Type = Event::EVENT_MOVED;
event.Move.X = x;
event.Move.Y = y;
pushEvent(event);
}
} }
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment