diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-02-09 21:25:29 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-02-09 21:25:29 +0100 |
commit | 289795b22a2ab0bf3f24e514c50f43df860f2690 (patch) | |
tree | b7cf5179b1e999b2d0e9395cbddf199a99062d1e /source | |
parent | 9b12f69fec93756e5e5b5c470d1250d5ffe9eb92 (diff) |
Fix finding active desktop!
Diffstat (limited to 'source')
-rw-r--r-- | source/dialogs/dmenu.c | 4 | ||||
-rw-r--r-- | source/rofi.c | 3 | ||||
-rw-r--r-- | source/textbox.c | 2 | ||||
-rw-r--r-- | source/x11-helper.c | 14 |
4 files changed, 19 insertions, 4 deletions
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index f336a1fd..a6153b6c 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -89,8 +89,8 @@ static char **get_dmenu ( FILE *fd, unsigned int *length ) data[l - 1] = '\0'; l--; } - if ( ! g_utf8_validate ( data, l, NULL) ) { - fprintf(stderr, "String: '%s' is not valid utf-8\n", data); + if ( !g_utf8_validate ( data, l, NULL ) ) { + fprintf ( stderr, "String: '%s' is not valid utf-8\n", data ); continue; } diff --git a/source/rofi.c b/source/rofi.c index 0a1f0d13..8db09233 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1568,7 +1568,8 @@ MenuState *menu ( Mode *sw, state->top_offset = state->border * 1 + state->line_height + 2 + config.line_margin * 2; // Move indicator to end. - widget_move ( WIDGET ( state->case_indicator ), state->border + textbox_get_width ( state->prompt_tb ) + entrybox_width, state->border ); + widget_move ( WIDGET ( state->case_indicator ), state->border + textbox_get_width ( state->prompt_tb ) + entrybox_width, + state->border ); textbox_text ( state->case_indicator, get_matching_state () ); state->message_tb = NULL; diff --git a/source/textbox.c b/source/textbox.c index d291327b..6a2ee40e 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -140,7 +140,7 @@ static void __textbox_update_pango_text ( textbox *tb ) pango_layout_set_attributes ( tb->layout, NULL ); pango_layout_set_text ( tb->layout, string, l ); } - else if ( tb->flags & TB_MARKUP || tb->tbft & MARKUP ) { + else if ( tb->flags & TB_MARKUP || tb->tbft & MARKUP ) { pango_layout_set_markup ( tb->layout, tb->text, -1 ); } else { diff --git a/source/x11-helper.c b/source/x11-helper.c index 9c408748..b21e6ff3 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -265,6 +265,20 @@ void monitor_active ( Display *display, workarea *mon ) } fprintf ( stderr, "Failed to find selected monitor.\n" ); } + // Get the current desktop. + unsigned long current_desktop = 0; + if ( window_get_cardinal_prop ( display, root, netatoms[_NET_CURRENT_DESKTOP], ¤t_desktop, 1 ) ) { + unsigned long desktops = 0; + if ( window_get_cardinal_prop ( display, root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1 ) ) { + unsigned long deskg[desktops * 2]; + if ( window_get_cardinal_prop ( display, root, netatoms[_NET_DESKTOP_VIEWPORT], &deskg[0], desktops * 2 ) ) { + if ( current_desktop < desktops ) { + monitor_dimensions ( display, screen, deskg[current_desktop * 2], deskg[current_desktop * 2 + 1], mon ); + return; + } + } + } + } if ( window_get_prop ( display, root, netatoms[_NET_ACTIVE_WINDOW], &type, &count, &id, sizeof ( Window ) ) && type == XA_WINDOW && count > 0 ) { XWindowAttributes attr; |