window.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # -*- coding: utf-8 -*-
  2. '''
  3. Copyright (C) 2012-2015 Diego Torres Milano
  4. Created on Jan 5, 2015
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. @author: Diego Torres Milano
  15. '''
  16. import sys
  17. DEBUG = False
  18. class Window(object):
  19. '''
  20. Window class
  21. '''
  22. def __init__(self, num, winId, activity, wvx, wvy, wvw, wvh, px, py, visibility, focused=False):
  23. '''
  24. Constructor
  25. @type num: int
  26. @param num: Ordering number in Window Manager
  27. @type winId: str
  28. @param winId: the window ID
  29. @type activity: str
  30. @param activity: the activity (or sometimes other component) owning the window
  31. @type wvx: int
  32. @param wvx: window's virtual X
  33. @type wvy: int
  34. @param wvy: window's virtual Y
  35. @type wvw: int
  36. @param wvw: window's virtual width
  37. @type wvh: int
  38. @param wvh: window's virtual height
  39. @type px: int
  40. @param px: parent's X
  41. @type py: int
  42. @param py: parent's Y
  43. @type visibility: int
  44. @param visibility: visibility of the window
  45. '''
  46. if DEBUG: print >> sys.stderr, "Window(%d, %s, %s, %d, %d, %d, %d, %d, %d, %d)" % \
  47. (num, winId, activity, wvx, wvy, wvw, wvh, px, py, visibility)
  48. self.num = num
  49. self.winId = winId
  50. self.activity = activity
  51. self.wvx = wvx
  52. self.wvy = wvy
  53. self.wvw = wvw
  54. self.wvh = wvh
  55. self.px = px
  56. self.py = py
  57. self.visibility = visibility
  58. self.focused = focused
  59. def __str__(self):
  60. return "Window(%d, wid=%s, a=%s, x=%d, y=%d, w=%d, h=%d, px=%d, py=%d, v=%d, f=%s)" % \
  61. (self.num, self.winId, self.activity, self.wvx, self.wvy, self.wvw, self.wvh, self.px, self.py, self.visibility, self.focused)