]> Dogcows Code - chaz/openbox/blob - scripts/clientmotion.py
so close to keybindings. wont link for now.
[chaz/openbox] / scripts / clientmotion.py
1 posqueue = [];
2
3 def def_motion_press(action, win, type, modifiers, button, xroot, yroot, time):
4 client = Openbox_findClient(openbox, win)
5
6 global posqueue
7 newi = [button, xroot, yroot]
8 if client:
9 newi.append(new_Rect(OBClient_area(client)))
10 posqueue.append(newi)
11
12 # ButtonPressAction *a = _posqueue[BUTTONS - 1];
13 # for (int i=BUTTONS-1; i>0;)
14 # _posqueue[i] = _posqueue[--i];
15 # _posqueue[0] = a;
16 # a->button = e.button;
17 # a->pos.setPoint(e.x_root, e.y_root);
18
19 # OBClient *c = Openbox::instance->findClient(e.window);
20 # // if it's not defined, they should have clicked on the root window, so this
21 # // area would be meaningless anyways
22 # if (c) a->clientarea = c->area();
23
24 def def_motion_release(action, win, type, modifiers, button, xroot, yroot,
25 time):
26 global posqueue
27 for i in posqueue:
28 if i[0] == button:
29 client = Openbox_findClient(openbox, win)
30 if client:
31 delete_Rect(i[3])
32 posqueue.remove(i)
33 break
34
35 def def_do_motion(client, xroot, yroot):
36 global posqueue
37 dx = xroot - posqueue[0][1]
38 dy = yroot - posqueue[0][2]
39 area = posqueue[0][3] # A Rect
40 OBClient_move(client, Rect_x(area) + dx, Rect_y(area) + dy)
41
42 def def_do_resize(client, xroot, yroot, archor_corner):
43 global posqueue
44 dx = xroot - posqueue[0][1]
45 dy = yroot - posqueue[0][2]
46 area = posqueue[0][3] # A Rect
47 OBClient_resize(client, anchor_corner,
48 Rect_width(area) - dx, Rect_height(area) + dy)
49
50 def def_motion(action, win, type, modifiers, xroot, yroot, time):
51 client = Openbox_findClient(openbox, win)
52 if not client: return
53
54 if (type == Type_Titlebar) or (type == Type_Label):
55 def_do_move(client, xroot, yroot)
56 elif type == Type_LeftGrip:
57 def_do_resize(client, xroot, yroot, OBClient_TopRight)
58 elif type == Type_RightGrip:
59 def_do_resize(client, xroot, yroot, OBClient_TopLeft)
60
61 def def_enter(action, win, type, modifiers):
62 client = Openbox_findClient(openbox, win)
63 if not client: return
64 OBClient_focus(client)
65
66 def def_leave(action, win, type, modifiers):
67 client = Openbox_findClient(openbox, win)
68 if not client: return
69
70
71 register(Action_EnterWindow, def_enter)
72 #register(Action_LeaveWindow, def_leave)
73
74 register(Action_ButtonPress, def_motion_press)
75 register(Action_ButtonRelease, def_motion_release)
76 register(Action_MouseMotion, def_motion)
77
78 print "Loaded clientmotion.py"
This page took 0.039276 seconds and 5 git commands to generate.