X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=d68be7d2dbe56be416af0fa9e004a3217e224e83;hb=f82d43238961d6605553683999d73f91f8516af3;hp=738fd9deb3dc60dcc3a93418373a5473f4dcae43;hpb=8586681805ba05a0b4daa80e08770fefa601220d;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 738fd9d..d68be7d 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -52,7 +52,7 @@ static const char *cvstag = "$scrotwm$"; -#define SWM_VERSION "0.9.22" +#define SWM_VERSION "0.9.24" #include #include @@ -154,6 +154,10 @@ u_int32_t swm_debug = 0 #define SWM_MAX_FONT_STEPS (3) #define WINID(w) (w ? w->id : 0) +#define SWM_FOCUS_DEFAULT (0) +#define SWM_FOCUS_SYNERGY (1) +#define SWM_FOCUS_FOLLOW (2) + #ifndef SWM_LIB #define SWM_LIB "/usr/local/lib/libswmhack.so" #endif @@ -201,6 +205,7 @@ int clock_enabled = 1; char *clock_format = NULL; int title_name_enabled = 0; int title_class_enabled = 0; +int focus_mode = SWM_FOCUS_DEFAULT; pid_t bar_pid; GC bar_gc; XGCValues bar_gcv; @@ -3333,8 +3338,7 @@ void setup_quirks(void) { setquirk("MPlayer", "xv", SWM_Q_FLOAT | SWM_Q_FULLSCREEN); - setquirk("OpenOffice.org 2.4", "VCLSalFrame", SWM_Q_FLOAT); - setquirk("OpenOffice.org 3.0", "VCLSalFrame", SWM_Q_FLOAT); + setquirk("OpenOffice.org 3.2", "VCLSalFrame", SWM_Q_FLOAT); setquirk("Firefox-bin", "firefox-bin", SWM_Q_TRANSSZ); setquirk("Firefox", "Dialog", SWM_Q_FLOAT); setquirk("Gimp", "gimp", SWM_Q_FLOAT | SWM_Q_ANYWHERE); @@ -3353,8 +3357,9 @@ setup_quirks(void) enum { SWM_S_BAR_DELAY, SWM_S_BAR_ENABLED, SWM_S_STACK_ENABLED, SWM_S_CLOCK_ENABLED, SWM_S_CLOCK_FORMAT, SWM_S_CYCLE_EMPTY, SWM_S_CYCLE_VISIBLE, SWM_S_SS_ENABLED, SWM_S_TERM_WIDTH, - SWM_S_TITLE_CLASS_ENABLED, SWM_S_TITLE_NAME_ENABLED, SWM_S_BAR_FONT, - SWM_S_BAR_ACTION, SWM_S_SPAWN_TERM, SWM_S_SS_APP, SWM_S_DIALOG_RATIO + SWM_S_TITLE_CLASS_ENABLED, SWM_S_TITLE_NAME_ENABLED, + SWM_S_FOCUS_MODE, SWM_S_BAR_FONT, SWM_S_BAR_ACTION, SWM_S_SPAWN_TERM, + SWM_S_SS_APP, SWM_S_DIALOG_RATIO }; int @@ -3398,6 +3403,16 @@ setconfvalue(char *selector, char *value, int flags) case SWM_S_TITLE_NAME_ENABLED: title_name_enabled = atoi(value); break; + case SWM_S_FOCUS_MODE: + if (!strcmp(value, "default")) + focus_mode = SWM_FOCUS_DEFAULT; + else if (!strcmp(value, "follow_cursor")) + focus_mode = SWM_FOCUS_FOLLOW; + else if (!strcmp(value, "synergy")) + focus_mode = SWM_FOCUS_SYNERGY; + else + err(1, "focus_mode"); + break; case SWM_S_BAR_FONT: free(bar_fonts[0]); if ((bar_fonts[0] = strdup(value)) == NULL) @@ -3488,7 +3503,8 @@ struct config_option configopt[] = { { "screenshot_app", setconfvalue, SWM_S_SS_APP }, { "term_width", setconfvalue, SWM_S_TERM_WIDTH }, { "title_class_enabled", setconfvalue, SWM_S_TITLE_CLASS_ENABLED }, - { "title_name_enabled", setconfvalue, SWM_S_TITLE_NAME_ENABLED } + { "title_name_enabled", setconfvalue, SWM_S_TITLE_NAME_ENABLED }, + { "focus_mode", setconfvalue, SWM_S_FOCUS_MODE }, }; @@ -4011,7 +4027,17 @@ enternotify(XEvent *e) ev->window, ev->mode, ev->detail, ev->root, ev->subwindow, ev->same_screen, ev->focus, ev->state); - goto focusme; + switch (focus_mode) { + case SWM_FOCUS_DEFAULT: + if (QLength(display)) { + DNPRINTF(SWM_D_EVENT, "ignore enternotify %d\n", + QLength(display)); + return; + } + break; + case SWM_FOCUS_FOLLOW: + break; + case SWM_FOCUS_SYNERGY: #if 0 /* * all these checks need to be in this order because the @@ -4080,11 +4106,7 @@ enternotify(XEvent *e) } } #endif -focusme: - if (QLength(display)) { - DNPRINTF(SWM_D_EVENT, "ignore enternotify %d\n", - QLength(display)); - return; + break; } if ((win = find_window(ev->window)) == NULL) {