/usr/share/pyshared/jarabe/frame/eventarea.py is in python-jarabe-0.96 0.96.1-2.1git1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | # Copyright (C) 2007, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import gtk
import gobject
import wnck
import gconf
_MAX_DELAY = 1000
class EventArea(gobject.GObject):
__gsignals__ = {
'enter': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
'leave': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
}
def __init__(self):
gobject.GObject.__init__(self)
self._windows = []
self._hover = False
self._sids = {}
client = gconf.client_get_default()
self._edge_delay = client.get_int('/desktop/sugar/frame/edge_delay')
self._corner_delay = client.get_int('/desktop/sugar/frame'
'/corner_delay')
right = gtk.gdk.screen_width() - 1
bottom = gtk.gdk.screen_height() - 1
width = gtk.gdk.screen_width() - 2
height = gtk.gdk.screen_height() - 2
if self._edge_delay != _MAX_DELAY:
invisible = self._create_invisible(1, 0, width, 1,
self._edge_delay)
self._windows.append(invisible)
invisible = self._create_invisible(1, bottom, width, 1,
self._edge_delay)
self._windows.append(invisible)
invisible = self._create_invisible(0, 1, 1, height,
self._edge_delay)
self._windows.append(invisible)
invisible = self._create_invisible(right, 1, 1, height,
self._edge_delay)
self._windows.append(invisible)
if self._corner_delay != _MAX_DELAY:
invisible = self._create_invisible(0, 0, 1, 1,
self._corner_delay)
self._windows.append(invisible)
invisible = self._create_invisible(right, 0, 1, 1,
self._corner_delay)
self._windows.append(invisible)
invisible = self._create_invisible(0, bottom, 1, 1,
self._corner_delay)
self._windows.append(invisible)
invisible = self._create_invisible(right, bottom, 1, 1,
self._corner_delay)
self._windows.append(invisible)
screen = wnck.screen_get_default()
screen.connect('window-stacking-changed',
self._window_stacking_changed_cb)
def _create_invisible(self, x, y, width, height, delay):
invisible = gtk.Invisible()
if delay >= 0:
invisible.connect('enter-notify-event', self._enter_notify_cb,
delay)
invisible.connect('leave-notify-event', self._leave_notify_cb)
invisible.drag_dest_set(0, [], 0)
invisible.connect('drag_motion', self._drag_motion_cb)
invisible.connect('drag_leave', self._drag_leave_cb)
invisible.realize()
# pylint: disable=E1101
invisible.window.set_events(gtk.gdk.POINTER_MOTION_MASK |
gtk.gdk.ENTER_NOTIFY_MASK |
gtk.gdk.LEAVE_NOTIFY_MASK)
invisible.window.move_resize(x, y, width, height)
return invisible
def _notify_enter(self):
if not self._hover:
self._hover = True
self.emit('enter')
def _notify_leave(self):
if self._hover:
self._hover = False
self.emit('leave')
def _enter_notify_cb(self, widget, event, delay):
if widget in self._sids:
gobject.source_remove(self._sids[widget])
self._sids[widget] = gobject.timeout_add(delay,
self.__delay_cb,
widget)
def __delay_cb(self, widget):
del self._sids[widget]
self._notify_enter()
return False
def _leave_notify_cb(self, widget, event):
if widget in self._sids:
gobject.source_remove(self._sids[widget])
del self._sids[widget]
self._notify_leave()
def _drag_motion_cb(self, widget, drag_context, x, y, timestamp):
drag_context.drag_status(0, timestamp)
self._notify_enter()
return True
def _drag_leave_cb(self, widget, drag_context, timestamp):
self._notify_leave()
return True
def show(self):
for window in self._windows:
window.show()
def hide(self):
for window in self._windows:
window.hide()
def _window_stacking_changed_cb(self, screen):
for window in self._windows:
window.window.raise_()
|