Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkogan/4085530 to your computer and use it in GitHub Desktop.
Save dkogan/4085530 to your computer and use it in GitHub Desktop.
notion patch to make responding to window raises optional
From e726626ded4ae0c844b13296519093b886926a05 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Fri, 16 Nov 2012 01:35:48 -0800
Subject: [PATCH] added configuration option to allow the user to block
responding to stacking events
---
etc/cfg_notion.lua | 5 +++++
ioncore/clientwin.c | 3 ++-
ioncore/conf.c | 26 +++++++++++++++++++++++++-
ioncore/global.h | 6 ++++++
ioncore/ioncore.c | 1 +
5 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/etc/cfg_notion.lua b/etc/cfg_notion.lua
index ff7d471..2ca787f 100644
--- a/etc/cfg_notion.lua
+++ b/etc/cfg_notion.lua
@@ -60,6 +60,11 @@ ioncore.set{
-- Mouse focus mode; set to "sloppy" if you want the focus to follow the
-- mouse, and to "disabled" otherwise.
--mousefocus="sloppy",
+
+ -- Controls Notion's reaction to stacking requests sent by clients. Set to
+ -- "ignore" to ignore these requests, and to "activate" to set the activity
+ -- flag on a window that requests to be stacked "Above".
+ --window_stacking_request="ignore",
}
diff --git a/ioncore/clientwin.c b/ioncore/clientwin.c
index 054bb27..e645413 100644
--- a/ioncore/clientwin.c
+++ b/ioncore/clientwin.c
@@ -1280,7 +1280,8 @@ static bool check_normal_cfgrq(WClientWin *cwin, XConfigureRequestEvent *ev)
result = TRUE;
}
- if(ev->value_mask&CWStackMode){
+ if( ioncore_g.window_stacking_request != IONCORE_WINDOWSTACKINGREQUEST_IGNORE &&
+ ev->value_mask&CWStackMode){
switch(ev->detail){
case Above:
region_set_activity((WRegion*) cwin, SETPARAM_SET);
diff --git a/ioncore/conf.c b/ioncore/conf.c
index 6602803..1d9c198 100644
--- a/ioncore/conf.c
+++ b/ioncore/conf.c
@@ -86,6 +86,10 @@ static ExtlFn get_layout_fn;
* \var{usertime_diff_current} & (integer) Controls switchto timeout. \\
* \var{usertime_diff_new} & (integer) Controls switchto timeout. \\
* \var{autosave_layout} & (boolean) Automatically save layout on restart and exit. \\
+ * \var{window_stacking_request} & (string) How to respond to window-stacking
+ * requests. \codestr{ignore} to do nothing,
+ * \codestr{activate} to set the activity flag on a
+ * window requesting to be stacked Above. \\
* \end{tabularx}
*
* When a keyboard resize function is called, and at most \var{kbresize_t_max}
@@ -112,6 +116,14 @@ void ioncore_set(ExtlTab tab)
extl_table_gets_b(tab, "unsqueeze", &(ioncore_g.unsqueeze_enabled));
extl_table_gets_b(tab, "autoraise", &(ioncore_g.autoraise));
extl_table_gets_b(tab, "autosave_layout", &(ioncore_g.autosave_layout));
+
+ if(extl_table_gets_s(tab, "window_stacking_request", &tmp)){
+ if(strcmp(tmp, "ignore")==0)
+ ioncore_g.window_stacking_request=IONCORE_WINDOWSTACKINGREQUEST_IGNORE;
+ else if(strcmp(tmp, "activate")==0)
+ ioncore_g.window_stacking_request=IONCORE_WINDOWSTACKINGREQUEST_ACTIVATE;
+ free(tmp);
+ }
if(extl_table_gets_s(tab, "frame_default_index", &tmp)){
ioncore_g.frame_default_index=stringintmap_value(frame_idxs,
@@ -177,7 +189,19 @@ ExtlTab ioncore_get()
extl_table_sets_b(tab, "unsqueeze", ioncore_g.unsqueeze_enabled);
extl_table_sets_b(tab, "autoraise", ioncore_g.autoraise);
extl_table_sets_b(tab, "autosave_layout", ioncore_g.autosave_layout);
-
+
+ const char* window_stacking_request_string;
+ switch( ioncore_g.window_stacking_request )
+ {
+ case IONCORE_WINDOWSTACKINGREQUEST_ACTIVATE:
+ window_stacking_request_string = "activate";
+ break;
+ case IONCORE_WINDOWSTACKINGREQUEST_IGNORE:
+ default:
+ window_stacking_request_string = "ignore";
+ break;
+ }
+ extl_table_sets_s(tab, "window_stacking_request", window_stacking_request_string);
extl_table_sets_s(tab, "frame_default_index",
stringintmap_key(frame_idxs,
diff --git a/ioncore/global.h b/ioncore/global.h
index 5b7c744..6b9c166 100644
--- a/ioncore/global.h
+++ b/ioncore/global.h
@@ -41,6 +41,11 @@ enum{
IONCORE_FOCUSNEXT_FALLBACK
};
+enum{
+ IONCORE_WINDOWSTACKINGREQUEST_IGNORE,
+ IONCORE_WINDOWSTACKINGREQUEST_ACTIVATE
+};
+
INTRSTRUCT(WGlobal);
@@ -93,6 +98,7 @@ DECLSTRUCT(WGlobal){
bool unsqueeze_enabled;
bool autoraise;
bool autosave_layout;
+ int window_stacking_request;
Time usertime_diff_current;
Time usertime_diff_new;
diff --git a/ioncore/ioncore.c b/ioncore/ioncore.c
index 1a54884..db7a0bd 100644
--- a/ioncore/ioncore.c
+++ b/ioncore/ioncore.c
@@ -365,6 +365,7 @@ static bool init_global()
ioncore_g.unsqueeze_enabled=TRUE;
ioncore_g.autoraise=TRUE;
ioncore_g.autosave_layout=TRUE;
+ ioncore_g.window_stacking_request=IONCORE_WINDOWSTACKINGREQUEST_IGNORE;
ioncore_g.enc_utf8=FALSE;
ioncore_g.enc_sb=TRUE;
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment