Remove more ctypes

This commit is contained in:
Clement Lefebvre 2017-04-28 12:45:07 +01:00
parent 931ccd73c6
commit ee8ae40cd0
6 changed files with 10 additions and 37 deletions

View File

@ -31,8 +31,6 @@ from Xlib.display import Display
from Xlib import X, error
from gi.repository import Gtk, Gdk, GdkX11, GObject, GLib
import threading
import ctypes
from ctypes import *
SPECIAL_MODS = (["Super_L", "<Super>"],
["Super_R", "<Super>"],
@ -169,11 +167,6 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread):
self.ungrab()
self.display.close()
class KeymapKey(Structure):
_fields_ = [("keycode", c_uint),
("group", c_int),
("level", c_int)]
class KeybindingWidget(Gtk.Box):
__gsignals__ = {
'accel-edited': (GObject.SignalFlags.RUN_LAST, None, ()),

View File

@ -14,8 +14,6 @@ import gettext
import traceback
import time
import gc
import ctypes
from ctypes import *
import xdg.Config
import keybinding
import pointerMonitor
@ -753,9 +751,8 @@ class MenuWin( object ):
ourWidth = self.mainwin.window.get_size()[0]
ourHeight = self.mainwin.window.get_size()[1] + self.mainwin.offset
x = c_int()
y = c_int()
# Get the dimensions/position of the widgetToAlignWith
print(self.applet.get_window().get_origin())
entryX = self.applet.get_window().get_origin().x
entryY = self.applet.get_window().get_origin().y

View File

@ -13,8 +13,6 @@ import threading
import commands
import subprocess
import filecmp
import ctypes
from ctypes import *
from easybuttons import *
from execute import Execute
from easygsettings import EasyGSettings
@ -149,11 +147,6 @@ class SuggestionButton ( Gtk.Button ):
def set_icon_size (self, size):
self.image.set_pixel_size( size )
class TargetEntry(Structure):
_fields_ = [("target", c_char_p),
("flags", c_int),
("info", c_int)]
class pluginclass( object ):
TARGET_TYPE_TEXT = 80
toButton = ( Gtk.TargetEntry.new( "text/uri-list", 0, TARGET_TYPE_TEXT ), Gtk.TargetEntry.new( "text/uri-list", 0, TARGET_TYPE_TEXT ) )

View File

@ -10,8 +10,6 @@ from execute import *
import xdg.DesktopEntry
import xdg.Menu
from filemonitor import monitor as filemonitor
import ctypes
from ctypes import *
class IconManager(GObject.GObject):
@ -232,11 +230,6 @@ class easyButton( Gtk.Button ):
#[ iW, iH ] = iconManager.getIconSize( self.iconSize )
self.buttonImage.set_size_request( self.iconSize, self.iconSize )
class TargetEntry(Structure):
_fields_ = [("target", c_char_p),
("flags", c_int),
("info", c_int)]
class ApplicationLauncher( easyButton ):
def __init__( self, desktopFile, iconSize):

View File

@ -6,8 +6,6 @@ import string
import gettext
import commands
import time
import ctypes
from ctypes import *
from easybuttons import *
from easygsettings import EasyGSettings

View File

@ -7,10 +7,6 @@ from Xlib.display import Display
from Xlib import X, error
from gi.repository import Gtk, Gdk, GObject, GLib
import threading
import ctypes
from ctypes import *
gdk = CDLL("libgdk-3.so.0")
class PointerMonitor(GObject.GObject, threading.Thread):
__gsignals__ = {
@ -27,9 +23,7 @@ class PointerMonitor(GObject.GObject, threading.Thread):
# Receives GDK windows
def addWindowToMonitor(self, window):
gdk.gdk_x11_drawable_get_xid.argtypes = [c_void_p]
xWindow = self.display.create_resource_object("window", gdk.gdk_x11_drawable_get_xid(hash(window)))
self.windows.append(xWindow)
self.windows.append(window)
def grabPointer(self):
self.root.grab_button(X.AnyButton, X.AnyModifier, True, X.ButtonPressMask, X.GrabModeSync, X.GrabModeAsync, 0, 0)
@ -54,9 +48,14 @@ class PointerMonitor(GObject.GObject, threading.Thread):
if event.type == X.ButtonPress:
# Check if pointer is inside monitored windows
for w in self.windows:
p = w.query_pointer()
g = w.get_geometry()
if p.win_x >= 0 and p.win_y >= 0 and p.win_x <= g.width and p.win_y <= g.height:
if Gtk.check_version (3, 20, 0) is None:
pdevice = Gdk.Display.get_default().get_default_seat().get_pointer()
else:
pdevice = Gdk.Display.get_default().get_device_manager().get_client_pointer()
p = self.get_window().get_device_position(pdevice)
g = self.get_size()
if p.x >= 0 and p.y >= 0 and p.x <= g.width and p.y <= g.height:
break
else:
# Is outside, so activate