summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2012-12-07 22:38:10 +0800
committerRichard Grenville <pyxlcy@gmail.com>2012-12-07 23:06:15 +0800
commitbfbf991af95a40ee5b6421da25b1e2e35e6002cc (patch)
tree991209181505a38ad3324ea20c097d669f1a427d /compton.h
parenta7c05d20f4c4a1c3f6514b6690b3ff3fdb3fe621 (diff)
downloadtdebase-bfbf991af95a40ee5b6421da25b1e2e35e6002cc.tar.gz
tdebase-bfbf991af95a40ee5b6421da25b1e2e35e6002cc.zip
Bug fix #68: Possible fix for failure in client window detection
- Note I'm not in the best state today (bad cold & sleep-deprived). This commit is likely to introduce bugs. - Attempt to fix client window detection failures happening when compton searches for client window before it's ready. - Fix build failure with <libpcre-8.20. Thanks to @pvanek for reporting in #51. - Move client window detection to a new function win_recheck_client(). - Add win_unmark_client(), which unmarks a client window. - Rename a few functions. - Split fetching of values of type-Window properties to a new function wid_get_prop_window(). - Add extra safety checks and assert calls to various functions, to expose potential bugs. - Fix a memory leak that w->role is not freed on window destruction.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/compton.h b/compton.h
index 9bc5bd091..6b4eed221 100644
--- a/compton.h
+++ b/compton.h
@@ -58,7 +58,10 @@
// For compatiblity with <libpcre-8.20
#ifndef PCRE_STUDY_JIT_COMPILE
-#define PCRE_STUDY_JIT_COMPILE 0
+#define PCRE_STUDY_JIT_COMPILE 0
+#define LPCRE_FREE_STUDY(extra) pcre_free(extra)
+#else
+#define LPCRE_FREE_STUDY(extra) pcre_free_study(extra)
#endif
#endif
@@ -1039,7 +1042,7 @@ free_wincond(wincond_t *cond) {
free(cond->pattern);
#ifdef CONFIG_REGEX_PCRE
if (cond->regex_pcre_extra)
- pcre_free_study(cond->regex_pcre_extra);
+ LPCRE_FREE_STUDY(cond->regex_pcre_extra);
if (cond->regex_pcre)
pcre_free(cond->regex_pcre);
#endif
@@ -1077,6 +1080,7 @@ free_win_res(session_t *ps, win *w) {
free(w->name);
free(w->class_instance);
free(w->class_general);
+ free(w->role);
}
/**
@@ -1149,15 +1153,15 @@ static inline bool is_normal_win(const win *w) {
}
/**
- * Determine if a window has a specific attribute.
+ * Determine if a window has a specific property.
*
* @param session_t current session
* @param w window to check
- * @param atom atom of attribute to check
+ * @param atom atom of property to check
* @return 1 if it has the attribute, 0 otherwise
*/
static inline bool
-wid_has_attr(const session_t *ps, Window w, Atom atom) {
+wid_has_prop(const session_t *ps, Window w, Atom atom) {
Atom type = None;
int format;
unsigned long nitems, after;
@@ -1451,6 +1455,10 @@ win_update_focused(session_t *ps, win *w) {
*/
static inline void
win_set_focused(session_t *ps, win *w, bool focused) {
+ // Unmapped windows will have their focused state reset on map
+ if (IsUnmapped == w->a.map_state)
+ return;
+
w->focused_real = focused;
win_update_focused(ps, w);
}
@@ -1480,7 +1488,13 @@ static void
calc_shadow_geometry(session_t *ps, win *w);
static void
-mark_client_win(session_t *ps, win *w, Window client);
+win_mark_client(session_t *ps, win *w, Window client);
+
+static void
+win_unmark_client(session_t *ps, win *w);
+
+static void
+win_recheck_client(session_t *ps, win *w);
static void
add_win(session_t *ps, Window id, Window prev);
@@ -1516,6 +1530,9 @@ static bool
wid_get_text_prop(session_t *ps, Window wid, Atom prop,
char ***pstrlst, int *pnstr);
+static Window
+wid_get_prop_window(session_t *ps, Window wid, Atom aprop);
+
static bool
wid_get_name(session_t *ps, Window w, char **name);