<action name="Resize"/>
</mousebind>
- <mousebind button="A-Middle" action="Click">
+ <mousebind button="A-Middle" action="Press">
<action name="Focus"/>
<action name="Lower"/>
</mousebind>
<mousebind button="Middle" action="Press">
<action name="Focus"/>
- </mousebind>
- <mousebind button="Middle" action="Click">
<action name="Lower"/>
</mousebind>
<mousebind button="Middle" action="Press">
<action name="Focus"/>
- </mousebind>
- <mousebind button="Middle" action="Click">
<action name="Lower"/>
</mousebind>
{
if (config_focus_follow)
if (data->any.context != OB_FRAME_CONTEXT_CLIENT) {
- if (!data->any.button && data->any.c)
+ if (!data->any.button && data->any.c) {
event_ignore_all_queued_enters();
- else {
- /* we USED to create a fake enter event here, so that when you
- used a Press context, and the button was still down,
- you could still get enter events that weren't
- NotifyWhileGrabbed.
-
- only problem with this is that then the resulting focus
- change events can ALSO be NotifyWhileGrabbed. And that is
- bad. So, don't create fake enter events anymore. */
+ } else {
+ ObClient *c;
+
+ /* usually this is sorta redundant, but with a press action
+ that moves windows our from under the cursor, the enter
+ event will come as a GrabNotify which is ignored, so this
+ makes a fake enter event
+ */
+ if ((c = client_under_pointer()))
+ event_enter_client(c);
}
}
}
if (data->execute.path) {
cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
if (cmd) {
- /* If there is an interactive action going on, then cancel it
- to release the keyboard, so that the run application
- can grab the keyboard if it wants to. */
- if (keyboard_interactively_grabbed())
- keyboard_interactive_cancel();
+ /* If there is a keyboard grab going on then we need to cancel
+ it so the application can grab things */
+ event_cancel_all_key_grabs();
if (!g_shell_parse_argv (cmd, NULL, &argv, &e)) {
g_message(_("Failed to execute '%s': %s"),
actions should not rely on being able to move focus during an
interactive grab.
*/
- if (keyboard_interactively_grabbed())
- keyboard_interactive_cancel();
+ event_cancel_all_key_grabs();
}
frame_hide(self->frame);
event.xconfigure.y = self->root_pos.y;
event.xconfigure.width = w;
event.xconfigure.height = h;
- event.xconfigure.border_width = 0;
+ event.xconfigure.border_width = self->border_width;
event.xconfigure.above = self->frame->plate;
event.xconfigure.override_redirect = FALSE;
XSendEvent(event.xconfigure.display, event.xconfigure.window,
actions should not rely on being able to move focus during an
interactive grab.
*/
- if (keyboard_interactively_grabbed())
- keyboard_interactive_cancel();
+ event_cancel_all_key_grabs();
xerror_set_ignore(TRUE);
xerror_occured = FALSE;
return FALSE;
}
+void event_cancel_all_key_grabs()
+{
+ if (keyboard_interactively_grabbed())
+ keyboard_interactive_cancel();
+ else if (menu_frame_visible)
+ menu_frame_hide_all();
+ else if (grab_on_keyboard())
+ ungrab_keyboard();
+ else
+ /* If we don't have the keyboard grabbed, then ungrab it with
+ XUngrabKeyboard, so that there is not a passive grab left
+ on from the KeyPress. If the grab is left on, and focus
+ moves during that time, it will be NotifyWhileGrabbed, and
+ applications like to ignore those! */
+ if (!keyboard_interactively_grabbed())
+ XUngrabKeyboard(ob_display, CurrentTime);
+
+}
+
gboolean event_time_after(Time t1, Time t2)
{
g_assert(t1 != CurrentTime);
till now. */
void event_ignore_all_queued_enters();
+/*! End *all* active and passive grabs on the keyboard */
+void event_cancel_all_key_grabs();
+
/* Halts any focus delay in progress, use this when the user is selecting a
window for focus */
void event_halt_focus_delay();
screen_install_colormap(client, TRUE);
/* in the middle of cycling..? kill it. */
- focus_cycle_stop();
+ focus_cycle_stop(focus_client);
+ focus_cycle_stop(client);
focus_client = client;
event_curtime);
}
+void focus_order_add_new(ObClient *c)
+{
+ if (c->iconic)
+ focus_order_to_top(c);
+ else {
+ g_assert(!g_list_find(focus_order, c));
+ /* if there are any iconic windows, put this above them in the order,
+ but if there are not, then put it under the currently focused one */
+ if (focus_order && ((ObClient*)focus_order->data)->iconic)
+ focus_order = g_list_insert(focus_order, c, 0);
+ else
+ focus_order = g_list_insert(focus_order, c, 1);
+ }
+
+ /* in the middle of cycling..? kill it. */
+ focus_cycle_stop(c);
+}
+
void focus_order_remove(ObClient *c)
{
focus_order = g_list_remove(focus_order, c);
+
+ /* in the middle of cycling..? kill it. */
+ focus_cycle_stop(c);
}
void focus_order_to_top(ObClient *c)
#include <X11/Xlib.h>
#include <glib.h>
-ObClient *focus_cycle_target = NULL;
+ObClient *focus_cycle_target = NULL;
+static gboolean focus_cycle_iconic_windows;
+static gboolean focus_cycle_all_desktops;
+static gboolean focus_cycle_dock_windows;
+static gboolean focus_cycle_desktop_windows;
-static void focus_cycle_destroy_notify (ObClient *client, gpointer data);
static gboolean focus_target_has_siblings (ObClient *ft,
gboolean iconic_windows,
gboolean all_desktops);
void focus_cycle_startup(gboolean reconfig)
{
if (reconfig) return;
-
- client_add_destroy_notify(focus_cycle_destroy_notify, NULL);
}
void focus_cycle_shutdown(gboolean reconfig)
{
if (reconfig) return;
-
- client_remove_destroy_notify(focus_cycle_destroy_notify);
-}
-
-void focus_cycle_stop()
-{
- if (focus_cycle_target)
- focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
}
-static void focus_cycle_destroy_notify(ObClient *client, gpointer data)
+void focus_cycle_stop(ObClient *ifclient)
{
- /* end cycling if the target disappears. CurrentTime is fine, time won't
- be used
- */
- if (focus_cycle_target == client)
+ /* stop focus cycling if the given client is a valid focus target,
+ and so the cycling is being disrupted */
+ if (focus_cycle_target && ifclient &&
+ focus_cycle_target_valid(ifclient,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows))
+ {
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
+ focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
+ }
}
/*! Returns if a focus target has valid group siblings that can be cycled
goto done_cycle;
list = client_list;
}
- if (!focus_cycle_target) focus_cycle_target = focus_client;
+
+
+ if (focus_cycle_target == NULL) {
+ focus_cycle_iconic_windows = TRUE;
+ focus_cycle_all_desktops = all_desktops;
+ focus_cycle_dock_windows = dock_windows;
+ focus_cycle_desktop_windows = desktop_windows;
+ focus_cycle_target = focus_client;
+ }
start = it = g_list_find(list, focus_cycle_target);
if (!start) /* switched desktops or something? */
if (it == NULL) it = g_list_last(list);
}
ft = it->data;
- if (focus_cycle_target_valid(ft, TRUE,
- all_desktops, dock_windows,
- desktop_windows))
+ if (focus_cycle_target_valid(ft,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows))
{
if (interactive) {
if (ft != focus_cycle_target) { /* prevents flicker */
}
if (dialog)
/* same arguments as focus_target_valid */
- focus_cycle_popup_show(ft, TRUE,
- all_desktops, dock_windows,
- desktop_windows);
+ focus_cycle_popup_show(ft,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows);
return;
} else if (ft != focus_cycle_target) {
focus_cycle_target = ft;
if (!focus_order)
goto done_cycle;
+ if (focus_cycle_target == NULL) {
+ focus_cycle_iconic_windows = FALSE;
+ focus_cycle_all_desktops = FALSE;
+ focus_cycle_dock_windows = dock_windows;
+ focus_cycle_desktop_windows = desktop_windows;
+ focus_cycle_target = focus_client;
+ }
+
if (!first) first = focus_client;
- if (!focus_cycle_target) focus_cycle_target = focus_client;
if (focus_cycle_target)
ft = focus_find_directional(focus_cycle_target, dir, dock_windows,
GList *it;
for (it = focus_order; it; it = g_list_next(it))
- if (focus_cycle_target_valid(it->data, FALSE, FALSE, dock_windows,
- desktop_windows))
+ if (focus_cycle_target_valid(it->data,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows))
ft = it->data;
}
if (focus_cycle_target && dialog) {
/* same arguments as focus_target_valid */
focus_cycle_popup_single_show(focus_cycle_target,
- FALSE, FALSE, dock_windows,
- desktop_windows);
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows);
return;
}
return;
}
-
-void focus_order_add_new(ObClient *c)
-{
- if (c->iconic)
- focus_order_to_top(c);
- else {
- g_assert(!g_list_find(focus_order, c));
- /* if there are any iconic windows, put this above them in the order,
- but if there are not, then put it under the currently focused one */
- if (focus_order && ((ObClient*)focus_order->data)->iconic)
- focus_order = g_list_insert(focus_order, c, 0);
- else
- focus_order = g_list_insert(focus_order, c, 1);
- }
-}
-
gboolean desktop_windows, gboolean interactive,
gboolean dialog, gboolean done, gboolean cancel);
-void focus_cycle_stop();
+void focus_cycle_stop(struct _ObClient *ifclient);
gboolean focus_cycle_target_valid(struct _ObClient *ft,
gboolean iconic_windows,
else {
keyboard_reset_chains(0);
- /* If we don't have the keyboard grabbed, then ungrab it with
- XUngrabKeyboard, so that there is not a passive grab left
- on from the KeyPress. If the grab is left on, and focus
- moves during that time, it will be NotifyWhileGrabbed, and
- applications like to ignore those! */
- if (!keyboard_interactively_grabbed())
- XUngrabKeyboard(ob_display, e->xkey.time);
-
action_run_key(p->actions, client, e->xkey.state,
e->xkey.x_root, e->xkey.y_root,
e->xkey.time);
XSetWindowBackground(display,win,WhitePixel(display,0));
XSetWindowBackground(display,child,BlackPixel(display,0));
- XSelectInput(display, win, FocusChangeMask);
+ XSelectInput(display, win,
+ FocusChangeMask|EnterWindowMask|LeaveWindowMask);
XMapWindow(display, win);
XMapWindow(display, child);
printf("mode : %s\n", mode);
printf("detail : %s\n", detail);
printf("---\n");
- }
+ break;
+ case EnterNotify:
+ switch (report.xcrossing.mode) {
+ case NotifyNormal: mode = "NotifyNormal"; break;
+ case NotifyGrab: mode = "NotifyGrab"; break;
+ case NotifyUngrab: mode = "NotifyUngrab"; break;
+ }
+
+ switch (report.xcrossing.detail) {
+ case NotifyAncestor: detail = "NotifyAncestor"; break;
+ case NotifyVirtual: detail = "NotifyVirtual"; break;
+ case NotifyInferior: detail = "NotifyInferior"; break;
+ case NotifyNonlinear: detail = "NotifyNonlinear"; break;
+ case NotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break;
+ case NotifyPointer: detail = "NotifyPointer"; break;
+ case NotifyPointerRoot: detail = "NotifyPointerRoot"; break;
+ case NotifyDetailNone: detail = "NotifyDetailNone"; break;
+ }
+ printf("enternotify\n");
+ printf("type : %d\n", report.xcrossing.type);
+ printf("serial : %d\n", report.xcrossing.serial);
+ printf("send_event: %d\n", report.xcrossing.send_event);
+ printf("display : 0x%x\n", report.xcrossing.display);
+ printf("window : 0x%x\n", report.xcrossing.window);
+ printf("mode : %s\n", mode);
+ printf("detail : %s\n", detail);
+ printf("---\n");
+ break;
+ case LeaveNotify:
+ switch (report.xcrossing.mode) {
+ case NotifyNormal: mode = "NotifyNormal"; break;
+ case NotifyGrab: mode = "NotifyGrab"; break;
+ case NotifyUngrab: mode = "NotifyUngrab"; break;
+ }
+ switch (report.xcrossing.detail) {
+ case NotifyAncestor: detail = "NotifyAncestor"; break;
+ case NotifyVirtual: detail = "NotifyVirtual"; break;
+ case NotifyInferior: detail = "NotifyInferior"; break;
+ case NotifyNonlinear: detail = "NotifyNonlinear"; break;
+ case NotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break;
+ case NotifyPointer: detail = "NotifyPointer"; break;
+ case NotifyPointerRoot: detail = "NotifyPointerRoot"; break;
+ case NotifyDetailNone: detail = "NotifyDetailNone"; break;
+ }
+ printf("leavenotify\n");
+ printf("type : %d\n", report.xcrossing.type);
+ printf("serial : %d\n", report.xcrossing.serial);
+ printf("send_event: %d\n", report.xcrossing.send_event);
+ printf("display : 0x%x\n", report.xcrossing.display);
+ printf("window : 0x%x\n", report.xcrossing.window);
+ printf("mode : %s\n", mode);
+ printf("detail : %s\n", detail);
+ printf("---\n");
+ break;
+ }
}
return 1;