1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SkOSWindow_Unix_DEFINED 18 #define SkOSWindow_Unix_DEFINED 19 20 #include "SkWindow.h" 21 #include <X11/Xlib.h> 22 23 struct SkUnixWindow { 24 Display* fDisplay; 25 Window fWin; 26 size_t fOSWin; 27 }; 28 29 class SkOSWindow : public SkWindow { 30 public: 31 SkOSWindow(Display* display, Window win); 32 getHWND()33 void* getHWND() const { return (void*)fUnixWindow.fWin; } getDisplay()34 void* getDisplay() const { return (void*)fUnixWindow.fDisplay; } getUnixWindow()35 void* getUnixWindow() const { return (void*)&fUnixWindow; } 36 void setSize(int width, int height); 37 void updateSize(); 38 39 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); 40 41 static bool WndProc(SkUnixWindow* w, XEvent &e); 42 43 protected: 44 // overrides from SkWindow 45 virtual void onHandleInval(const SkIRect&); 46 // overrides from SkView 47 virtual void onAddMenu(const SkOSMenu*); 48 49 private: 50 SkUnixWindow fUnixWindow; 51 52 void doPaint(); 53 54 void* fMBar; 55 56 typedef SkWindow INHERITED; 57 }; 58 59 #endif 60 61