Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Unified Diff: src/views/unix/SkOSWindow_Unix.cpp

Issue 377733002: Handle close button in SkOSWindow_Unix. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/views/unix/SkOSWindow_Unix.cpp
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index 078a9f9d56c6a15e79c78a2acd2e7f4d1cec8e6e..fad59225177763caa44d0bfd398da9ab9a069bcb 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -200,11 +200,13 @@ static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) {
return true;
}
+static Atom wm_delete_window_message;
+
SkOSWindow::NextXEventResult SkOSWindow::nextXEvent() {
XEvent evt;
Display* dsp = fUnixWindow.fDisplay;
- if (!MyXNextEventWithDelay(fUnixWindow.fDisplay, &evt)) {
+ if (!MyXNextEventWithDelay(dsp, &evt)) {
return kContinue_NextXEventResult;
}
@@ -248,6 +250,11 @@ SkOSWindow::NextXEventResult SkOSWindow::nextXEvent() {
case KeyRelease:
this->handleKeyUp(XKeyToSkKey(XkbKeycodeToKeysym(dsp, evt.xkey.keycode, 0, 0)));
break;
+ case ClientMessage:
+ if ((Atom)evt.xclient.data.l[0] == wm_delete_window_message) {
+ return kQuitRequest_NextXEventResult;
+ }
+ // fallthrough
default:
// Do nothing for other events
break;
@@ -262,6 +269,9 @@ void SkOSWindow::loop() {
}
Window win = fUnixWindow.fWin;
+ wm_delete_window_message = XInternAtom(dsp, "WM_DELETE_WINDOW", False);
+ XSetWMProtocols(dsp, win, &wm_delete_window_message, 1);
+
XSelectInput(dsp, win, EVENT_MASK);
bool sentExposeEvent = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698