Back to index

unity  6.0.0
screen.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * version 3 along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>
00016  *
00017  * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
00018  *
00019  */
00020 
00021 #ifndef COMPIZ_SCREEN_MOCK_H
00022 #define COMPIZ_SCREEN_MOCK_H
00023 
00024 #include <X11/Xlib.h>
00025 #include <vector>
00026 
00027 // The real CompScreen
00028 #include <core/screen.h>
00029 
00030 typedef std::vector<CompWindowMock*> CompWindowMockVector;
00031 
00032 class CompScreenMock {
00033 public:
00034   CompScreenMock() : _grab_count(0) {}
00035 
00036   typedef int GrabHandle;
00037 
00038   int width() const {return _width;}
00039   int height() const {return _height;}
00040 
00041   Display *dpy() {return _dpy;}
00042 
00043   const CompWindowMockVector & clientList(bool stackingOrder = true) {
00044     if (stackingOrder)
00045       return _client_list_stacking;
00046     else
00047       return _client_list;
00048   }
00049 
00050   Window root() {return _root;}
00051 
00052   GrabHandle pushGrab(Cursor cursor, const char *name) {
00053     _grab_count++;
00054     return 0;
00055   }
00056   void removeGrab(GrabHandle handle, CompPoint *restorePointer) {
00057     _grab_count--;
00058   }
00059 
00060   Cursor invisibleCursor() {return 1;}
00061 
00062   int _width;
00063   int _height;
00064   Display *_dpy;
00065   CompWindowMockVector _client_list;
00066   CompWindowMockVector _client_list_stacking;
00067   Window _root;
00068   int _grab_count;
00069 };
00070 
00071 extern CompScreenMock *screen_mock;
00072 extern int pointerX_mock;
00073 extern int pointerY_mock;
00074 
00075 #endif
00076