~kokoto-java/kazam/depencie-and-stuff

« back to all changes in this revision

Viewing changes to kazam/backend/constants.py

  • Committer: David Klasinc
  • Date: 2012-11-11 19:36:05 UTC
  • mfrom: (193.2.82 unstable)
  • Revision ID: bigwhale@lubica.net-20121111193605-vh3fxglxwfhyh8ne
Merged from unstable branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
MODE_ALL = 1
89
89
MODE_AREA = 2
90
90
MODE_WIN = 3
 
91
MODE_ACTIVE = 4
 
92
MODE_GOD = 666
91
93
 
92
94
import logging
93
95
 
94
 
from gi.repository import Gdk
 
96
from gi.repository import Gdk, GdkX11
95
97
 
96
98
class hw:
97
99
    def __init__(self):
107
109
            if window:
108
110
                screen = self.default_screen.get_monitor_at_window(window.get_window())
109
111
            else:
110
 
                root = self.default_screen.get_root_window()
111
 
                pointer = root.get_pointer()
112
 
                screen = self.default_screen.get_monitor_at_point(pointer[1], pointer[2])
 
112
                disp = GdkX11.X11Display.get_default()
 
113
                dm = Gdk.Display.get_device_manager(disp)
 
114
                pntr_device = dm.get_client_pointer()
 
115
                (src, x, y) = pntr_device.get_position()
 
116
                screen = self.default_screen.get_monitor_at_point(x, y)
113
117
        except:
114
118
           screen = 0
115
119
        return screen
139
143
                                       "height": self.default_screen.get_height()}
140
144
                self.logger.debug("  Combined screen - X: 0, Y: 0, W: {0}, H: {1}".format(self.default_screen.get_width(),
141
145
                                                                                          self.default_screen.get_height()))
 
146
            else:
 
147
                self.combined_screen = None
142
148
 
143
149
        except:
144
150
            self.logger.warning("Unable to find any video sources.")