1 import config
, hooks
, ob
2 from input import Pointer
7 "The amount of resistance to provide to moving a window past a " + \
8 "screen boundary. Specify a value of 0 to disable edge resistance.",
13 def move(ptrdata
, client
):
14 def mymove(ptrdata
, client
):
15 global _moving
, _last_pos
16 if ptrdata
.action
== Pointer
.Action_Release
:
17 _moveclient
.setArea(_moveclient
.area(), True) # finalize the move
20 elif ptrdata
.action
== Pointer
.Action_Motion
:
23 x
= _pcarea
[0] + pos
[0] - _presspos
[0]
24 y
= _pcarea
[1] + pos
[1] - _presspos
[1]
26 resist
= config
.get('motion', 'edge_resistance')
28 ca
= _moveclient
.area()
30 # use the area based on the struts
31 sa
= ob
.Openbox
.screenArea(_moveclient
.desktop())
36 if _last_pos
[0] >= pos
[0] and x
< l
and x
>= l
- resist
:
39 if _last_pos
[0] <= pos
[0] and x
> r
and x
<= r
+ resist
:
42 if _last_pos
[1] >= pos
[1] and y
< t
and y
>= t
- resist
:
45 if _last_pos
[1] <= pos
[1] and y
> b
and y
<= b
+ resist
:
48 _moveclient
.setArea((x
, y
, _pcarea
[2], _pcarea
[3]), False)
51 global _last_pos
, _moving
, _pcarea
, _presspos
, _moveclient
54 _pcarea
= ptrdata
.pressclientarea
55 _presspos
= ptrdata
.presspos
59 mymove(ptrdata
, client
)
61 def resize(ptrdata
, client
):
63 px
, py
= ptrdata
.presspos
64 cx
, cy
, cw
, ch
= ptrdata
.pressclientarea
67 if px
< cx
+ cw
/ 2: # left side
70 if py
< cy
+ ch
/ 2: # top side
75 client
.setArea((cx
, cy
, cw
, ch
))