| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 0, 0, // dst x,y | 449 0, 0, // dst x,y |
| 450 width, height); | 450 width, height); |
| 451 } | 451 } |
| 452 | 452 |
| 453 enum { | 453 enum { |
| 454 _NET_WM_STATE_REMOVE =0, | 454 _NET_WM_STATE_REMOVE =0, |
| 455 _NET_WM_STATE_ADD = 1, | 455 _NET_WM_STATE_ADD = 1, |
| 456 _NET_WM_STATE_TOGGLE =2 | 456 _NET_WM_STATE_TOGGLE =2 |
| 457 }; | 457 }; |
| 458 | 458 |
| 459 void SkOSWindow::setFullscreen(bool setFullscreen) { | 459 bool SkOSWindow::makeFullscreen() { |
| 460 Display* dsp = fUnixWindow.fDisplay; | 460 Display* dsp = fUnixWindow.fDisplay; |
| 461 if (NULL == dsp) { | 461 if (NULL == dsp) { |
| 462 return; | 462 return false; |
| 463 } | 463 } |
| 464 | 464 |
| 465 // Full screen | 465 // Full screen |
| 466 Atom wm_state = XInternAtom(dsp, "_NET_WM_STATE", False); | 466 Atom wm_state = XInternAtom(dsp, "_NET_WM_STATE", False); |
| 467 Atom fullscreen = XInternAtom(dsp, "_NET_WM_STATE_FULLSCREEN", False); | 467 Atom fullscreen = XInternAtom(dsp, "_NET_WM_STATE_FULLSCREEN", False); |
| 468 | 468 |
| 469 XEvent evt; | 469 XEvent evt; |
| 470 sk_bzero(&evt, sizeof(evt)); | 470 sk_bzero(&evt, sizeof(evt)); |
| 471 evt.type = ClientMessage; | 471 evt.type = ClientMessage; |
| 472 evt.xclient.window = fUnixWindow.fWin; | 472 evt.xclient.window = fUnixWindow.fWin; |
| 473 evt.xclient.message_type = wm_state; | 473 evt.xclient.message_type = wm_state; |
| 474 evt.xclient.format = 32; | 474 evt.xclient.format = 32; |
| 475 evt.xclient.data.l[0] = setFullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_RE
MOVE; | 475 evt.xclient.data.l[0] = _NET_WM_STATE_ADD; |
| 476 evt.xclient.data.l[1] = fullscreen; | 476 evt.xclient.data.l[1] = fullscreen; |
| 477 evt.xclient.data.l[2] = 0; | 477 evt.xclient.data.l[2] = 0; |
| 478 | 478 |
| 479 XSendEvent(dsp, DefaultRootWindow(dsp), False, | 479 XSendEvent(dsp, DefaultRootWindow(dsp), False, |
| 480 SubstructureRedirectMask | SubstructureNotifyMask, &evt); | 480 SubstructureRedirectMask | SubstructureNotifyMask, &evt); |
| 481 return true; |
| 481 } | 482 } |
| 482 | 483 |
| 483 void SkOSWindow::setVsync(bool vsync) { | 484 void SkOSWindow::setVsync(bool vsync) { |
| 484 if (fUnixWindow.fDisplay && fUnixWindow.fGLContext && fUnixWindow.fWin) { | 485 if (fUnixWindow.fDisplay && fUnixWindow.fGLContext && fUnixWindow.fWin) { |
| 485 int swapInterval = vsync ? 1 : 0; | 486 int swapInterval = vsync ? 1 : 0; |
| 486 glXSwapInterval(fUnixWindow.fDisplay, fUnixWindow.fWin, swapInterval); | 487 glXSwapInterval(fUnixWindow.fDisplay, fUnixWindow.fWin, swapInterval); |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 | 490 |
| 490 void SkOSWindow::closeWindow() { | 491 void SkOSWindow::closeWindow() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 509 | 510 |
| 510 void SkEvent::SignalNonEmptyQueue() { | 511 void SkEvent::SignalNonEmptyQueue() { |
| 511 // nothing to do, since we spin on our event-queue, polling for XPending | 512 // nothing to do, since we spin on our event-queue, polling for XPending |
| 512 } | 513 } |
| 513 | 514 |
| 514 void SkEvent::SignalQueueTimer(SkMSec delay) { | 515 void SkEvent::SignalQueueTimer(SkMSec delay) { |
| 515 // just need to record the delay time. We handle waking up for it in | 516 // just need to record the delay time. We handle waking up for it in |
| 516 // MyXNextEventWithDelay() | 517 // MyXNextEventWithDelay() |
| 517 gTimerDelay = delay; | 518 gTimerDelay = delay; |
| 518 } | 519 } |
| OLD | NEW |