mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Small cleanups.
This commit is contained in:
parent
8817b6a602
commit
faa360041e
2 changed files with 35 additions and 13 deletions
|
@ -202,6 +202,7 @@ static DmenuScriptEntry *execute_executor(Mode *sw, char *arg,
|
||||||
actual_size += 256;
|
actual_size += 256;
|
||||||
retv = g_realloc(retv, (actual_size) * sizeof(DmenuScriptEntry));
|
retv = g_realloc(retv, (actual_size) * sizeof(DmenuScriptEntry));
|
||||||
}
|
}
|
||||||
|
if (retv) {
|
||||||
size_t buf_length = strlen(buffer) + 1;
|
size_t buf_length = strlen(buffer) + 1;
|
||||||
retv[(*length)].entry = g_memdup(buffer, buf_length);
|
retv[(*length)].entry = g_memdup(buffer, buf_length);
|
||||||
retv[(*length)].icon_name = NULL;
|
retv[(*length)].icon_name = NULL;
|
||||||
|
@ -218,6 +219,7 @@ static DmenuScriptEntry *execute_executor(Mode *sw, char *arg,
|
||||||
(*length)++;
|
(*length)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
20
source/xcb.c
20
source/xcb.c
|
@ -747,6 +747,10 @@ static int monitor_get_dimension(int monitor_id, workarea *mon) {
|
||||||
}
|
}
|
||||||
// find the dimensions of the monitor displaying point x,y
|
// find the dimensions of the monitor displaying point x,y
|
||||||
static void monitor_dimensions(int x, int y, workarea *mon) {
|
static void monitor_dimensions(int x, int y, workarea *mon) {
|
||||||
|
if (mon == NULL) {
|
||||||
|
g_error("%s: mon == NULL", __FUNCTION__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
memset(mon, 0, sizeof(workarea));
|
memset(mon, 0, sizeof(workarea));
|
||||||
mon->w = xcb->screen->width_in_pixels;
|
mon->w = xcb->screen->width_in_pixels;
|
||||||
mon->h = xcb->screen->height_in_pixels;
|
mon->h = xcb->screen->height_in_pixels;
|
||||||
|
@ -786,6 +790,10 @@ static int pointer_get(xcb_window_t root, int *x, int *y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int monitor_active_from_winid(xcb_drawable_t id, workarea *mon) {
|
static int monitor_active_from_winid(xcb_drawable_t id, workarea *mon) {
|
||||||
|
if (mon == NULL) {
|
||||||
|
g_error("%s: mon == NULL", __FUNCTION__);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
xcb_window_t root = xcb->screen->root;
|
xcb_window_t root = xcb->screen->root;
|
||||||
xcb_get_geometry_cookie_t c = xcb_get_geometry(xcb->connection, id);
|
xcb_get_geometry_cookie_t c = xcb_get_geometry(xcb->connection, id);
|
||||||
xcb_get_geometry_reply_t *r =
|
xcb_get_geometry_reply_t *r =
|
||||||
|
@ -815,6 +823,10 @@ static int monitor_active_from_id_focused(int mon_id, workarea *mon) {
|
||||||
int retv = FALSE;
|
int retv = FALSE;
|
||||||
xcb_window_t active_window;
|
xcb_window_t active_window;
|
||||||
xcb_get_property_cookie_t awc;
|
xcb_get_property_cookie_t awc;
|
||||||
|
if (mon == NULL) {
|
||||||
|
g_error("%s: mon == NULL", __FUNCTION__);
|
||||||
|
return retv;
|
||||||
|
}
|
||||||
awc = xcb_ewmh_get_active_window(&xcb->ewmh, xcb->screen_nbr);
|
awc = xcb_ewmh_get_active_window(&xcb->ewmh, xcb->screen_nbr);
|
||||||
if (!xcb_ewmh_get_active_window_reply(&xcb->ewmh, awc, &active_window,
|
if (!xcb_ewmh_get_active_window_reply(&xcb->ewmh, awc, &active_window,
|
||||||
NULL)) {
|
NULL)) {
|
||||||
|
@ -880,6 +892,10 @@ static int monitor_active_from_id_focused(int mon_id, workarea *mon) {
|
||||||
static int monitor_active_from_id(int mon_id, workarea *mon) {
|
static int monitor_active_from_id(int mon_id, workarea *mon) {
|
||||||
xcb_window_t root = xcb->screen->root;
|
xcb_window_t root = xcb->screen->root;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
if (mon == NULL) {
|
||||||
|
g_error("%s: mon == NULL", __FUNCTION__);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
g_debug("Monitor id: %d", mon_id);
|
g_debug("Monitor id: %d", mon_id);
|
||||||
// At mouse position.
|
// At mouse position.
|
||||||
if (mon_id == -3) {
|
if (mon_id == -3) {
|
||||||
|
@ -955,6 +971,10 @@ workarea mon_cache = {
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
int monitor_active(workarea *mon) {
|
int monitor_active(workarea *mon) {
|
||||||
|
if (mon == NULL) {
|
||||||
|
g_error("%s: mon == NULL", __FUNCTION__);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
g_debug("Monitor active");
|
g_debug("Monitor active");
|
||||||
if (mon_set) {
|
if (mon_set) {
|
||||||
if (mon) {
|
if (mon) {
|
||||||
|
|
Loading…
Reference in a new issue