From f7e3eb57294f9e73da2e342b503ca360485ae130 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 31 Dec 2002 08:46:17 +0000 Subject: add some globals to modify the default scripting behavior --- scripts/clicks.py | 5 +++-- scripts/clientmotion.py | 22 ++++++---------------- scripts/globals.py | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/scripts/clicks.py b/scripts/clicks.py index f9d2cb6f..91429d1f 100644 --- a/scripts/clicks.py +++ b/scripts/clicks.py @@ -26,7 +26,8 @@ def def_press_model(action, win, type, modifiers, button, xroot, yroot, time): type == Type_MaximizeButton or type == Type_CloseButton): return - OBClient_focus(client) + if click_focus != 0: + OBClient_focus(client) print "OBClient_raise(client)" def def_click_root(action, win, type, modifiers, button, time): @@ -52,7 +53,7 @@ def def_doubleclick_client(action, win, type, modifiers, button, time): print "OBClient_toggleshade(client)" -#preregister(Action_ButtonPress, def_press_model) +preregister(Action_ButtonPress, def_press_model) register(Action_Click, def_click_client) register(Action_Click, def_click_root) register(Action_DoubleClick, def_doubleclick_client) diff --git a/scripts/clientmotion.py b/scripts/clientmotion.py index e34afed4..bd446f87 100644 --- a/scripts/clientmotion.py +++ b/scripts/clientmotion.py @@ -9,24 +9,11 @@ def def_motion_press(action, win, type, modifiers, button, xroot, yroot, time): newi.append(new_Rect(OBClient_area(client))) posqueue.append(newi) - # ButtonPressAction *a = _posqueue[BUTTONS - 1]; - # for (int i=BUTTONS-1; i>0;) - # _posqueue[i] = _posqueue[--i]; - # _posqueue[0] = a; - # a->button = e.button; - # a->pos.setPoint(e.x_root, e.y_root); - - # OBClient *c = Openbox::instance->findClient(e.window); - # // if it's not defined, they should have clicked on the root window, so this - # // area would be meaningless anyways - # if (c) a->clientarea = c->area(); - def def_motion_release(action, win, type, modifiers, button, xroot, yroot, time): global posqueue for i in posqueue: if i[0] == button: - print "hi" client = Openbox_findClient(openbox, win) if client: delete_Rect(i[3]) @@ -53,7 +40,7 @@ def def_motion(action, win, type, modifiers, xroot, yroot, time): if not client: return if (type == Type_Titlebar) or (type == Type_Label): - def_do_move(client, xroot, yroot) + def_do_motion(client, xroot, yroot) elif type == Type_LeftGrip: def_do_resize(client, xroot, yroot, OBClient_TopRight) elif type == Type_RightGrip: @@ -62,15 +49,18 @@ def def_motion(action, win, type, modifiers, xroot, yroot, time): def def_enter(action, win, type, modifiers): client = Openbox_findClient(openbox, win) if not client: return - OBClient_focus(client) + if enter_focus != 0: + OBClient_focus(client) def def_leave(action, win, type, modifiers): client = Openbox_findClient(openbox, win) if not client: return + if leave_unfocus != 0: + OBClient_unfocus(client) register(Action_EnterWindow, def_enter) -#register(Action_LeaveWindow, def_leave) +register(Action_LeaveWindow, def_leave) register(Action_ButtonPress, def_motion_press) register(Action_ButtonRelease, def_motion_release) diff --git a/scripts/globals.py b/scripts/globals.py index 98f71c34..2a9d8240 100644 --- a/scripts/globals.py +++ b/scripts/globals.py @@ -6,4 +6,19 @@ screen = [] for i in range(Openbox_screenCount(openbox)): screen.append(Openbox_screen(openbox, i)) +# client_buttons - a list of the modifier(s) and buttons which are grabbed on +# client windows (for interactive move/resize, etc) +# examples: "A-2", "C-A-2", "W-1" +client_buttons = ["A-1", "A-2", "A-3"] + +# click_focus - true if clicking in a client will cause it to focus in the +# default hook functions +click_focus = 0 +# enter_focus - true if entering a client window will cause it to focus in the +# default hook functions +enter_focus = 1 +# leave_unfocus - true if leaving a client window will cause it to unfocus in +# the default hook functions +leave_unfocus = 1 + print "Loaded globals.py" -- cgit v1.2.3