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

Side by Side Diff: src/views/unix/SkOSWindow_Unix.cpp

Issue 1181723006: Move closeWindow()/setFullscreen()/setVSynv() from SkWindow to SkOSWindow (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « include/views/SkWindow.h ('k') | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/views/SkWindow.h ('k') | src/views/win/SkOSWindow_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698