summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/rofi-script.5.markdown2
-rw-r--r--include/xcb.h2
-rw-r--r--source/rofi-icon-fetcher.c13
-rw-r--r--source/xcb.c61
4 files changed, 44 insertions, 34 deletions
diff --git a/doc/rofi-script.5.markdown b/doc/rofi-script.5.markdown
index 53a463d2..527c07a0 100644
--- a/doc/rofi-script.5.markdown
+++ b/doc/rofi-script.5.markdown
@@ -143,7 +143,7 @@ The following options are supported:
- **nonselectable**: If true the row cannot activated.
-- **permantent**: If true the row always shows, independent of filter.
+- **permanent**: If true the row always shows, independent of filter.
- **info**: Info that, on selection, gets placed in the `ROFI_INFO`
environment variable. This entry does not get searched for filtering.
diff --git a/include/xcb.h b/include/xcb.h
index d56b2cf3..b4a7a3ba 100644
--- a/include/xcb.h
+++ b/include/xcb.h
@@ -209,8 +209,6 @@ typedef enum {
WM_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
/** PANGO WORKSPACE NAMES */
WM_PANGO_WORKSPACE_NAMES = 2,
- /** Root window offset (for bspwm) */
- WM_ROOT_WINDOW_OFFSET = 4,
} WindowManagerQuirk;
/**
diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c
index ef19bf5f..ef5847a9 100644
--- a/source/rofi-icon-fetcher.c
+++ b/source/rofi-icon-fetcher.c
@@ -354,6 +354,7 @@ static void rofi_icon_fetcher_worker(thread_state *sdata,
}
cairo_surface_t *icon_surf = NULL;
+#if 0 // unsure why added in past?
const char *suf = strrchr(icon_path, '.');
if (suf == NULL) {
sentry->query_done = TRUE;
@@ -361,10 +362,22 @@ static void rofi_icon_fetcher_worker(thread_state *sdata,
rofi_view_reload();
return;
}
+#endif
GError *error = NULL;
GdkPixbuf *pb = gdk_pixbuf_new_from_file_at_scale(
icon_path, sentry->wsize, sentry->hsize, TRUE, &error);
+
+ /*
+ * The GIF codec throws GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION if it's closed
+ * without decoding all the frames. Since gdk_pixbuf_new_from_file_at_scale
+ * only decodes the first frame, this specific error needs to be ignored.
+ */
+ if (error != NULL && g_error_matches(error, GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION)) {
+ g_clear_error(&error);
+ }
+
if (error != NULL) {
g_warning("Failed to load image: |%s| %d %d %s (%p)", icon_path,
sentry->wsize, sentry->hsize, error->message, (void *)pb);
diff --git a/source/xcb.c b/source/xcb.c
index ccdec05a..2b50ccb0 100644
--- a/source/xcb.c
+++ b/source/xcb.c
@@ -881,37 +881,38 @@ static int monitor_active_from_id_focused(int mon_id, workarea *mon) {
free(tree_reply);
return retv;
}
- xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates(
- xcb->connection, tree_reply->parent, r->root, r->x, r->y);
- xcb_translate_coordinates_reply_t *t =
- xcb_translate_coordinates_reply(xcb->connection, ct, NULL);
- if (t) {
- if (mon_id == -2) {
- // place the menu above the window
- // if some window is focused, place menu above window, else fall
- // back to selected monitor.
- mon->x = t->dst_x - r->x;
- mon->y = t->dst_y - r->y;
- mon->w = r->width;
- mon->h = r->height;
- retv = TRUE;
- if ((current_window_manager & WM_ROOT_WINDOW_OFFSET) ==
- WM_ROOT_WINDOW_OFFSET) {
- mon->x += r->x;
- mon->y += r->y;
- }
- g_debug("mon pos: %d %d %d-%d", mon->x, mon->y, mon->w, mon->h);
- } else if (mon_id == -4) {
- g_debug("Find monitor at location: %d %d", t->dst_x, t->dst_y);
- monitor_dimensions(t->dst_x, t->dst_y, mon);
- g_debug("Monitor found pos: %d %d %d-%d", mon->x, mon->y, mon->w, mon->h);
- retv = TRUE;
+ if (tree_reply->parent != r->root) {
+ xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates(
+ xcb->connection, tree_reply->parent, r->root, r->x, r->y);
+ xcb_translate_coordinates_reply_t *t =
+ xcb_translate_coordinates_reply(xcb->connection, ct, NULL);
+ if (t) {
+ r->x = t->dst_x;
+ r->y = t->dst_y;
+ free(t);
+ } else {
+ g_debug("Failed to get translate position of active window, falling back "
+ "to mouse location (-5).");
+ free(r);
+ free(tree_reply);
+ return retv;
}
- free(t);
- } else {
- g_debug("Failed to get translate position of active window, falling back "
- "to mouse location (-5).");
}
+ if (mon_id == -2) {
+ // place the menu above the window
+ // if some window is focused, place menu above window, else fall
+ // back to selected monitor.
+ mon->x = r->x + r->border_width;
+ mon->y = r->y + r->border_width;
+ mon->w = r->width;
+ mon->h = r->height;
+ retv = TRUE;
+ } else if (mon_id == -4) {
+ g_debug("Find monitor at location: %d %d", r->x, r->y);
+ monitor_dimensions(r->x, r->y, mon);
+ retv = TRUE;
+ }
+ g_debug("mon pos: %d %d %d-%d", mon->x, mon->y, mon->w, mon->h);
free(r);
free(tree_reply);
return retv;
@@ -1642,8 +1643,6 @@ static void x11_helper_discover_window_manager(void) {
if (g_strcmp0(str, "i3") == 0) {
current_window_manager =
WM_DO_NOT_CHANGE_CURRENT_DESKTOP | WM_PANGO_WORKSPACE_NAMES;
- } else if (g_strcmp0(str, "bspwm") == 0) {
- current_window_manager = WM_ROOT_WINDOW_OFFSET;
}
g_free(str);
}