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,20 +202,22 @@ static DmenuScriptEntry *execute_executor(Mode *sw, char *arg,
|
|||
actual_size += 256;
|
||||
retv = g_realloc(retv, (actual_size) * sizeof(DmenuScriptEntry));
|
||||
}
|
||||
size_t buf_length = strlen(buffer) + 1;
|
||||
retv[(*length)].entry = g_memdup(buffer, buf_length);
|
||||
retv[(*length)].icon_name = NULL;
|
||||
retv[(*length)].meta = NULL;
|
||||
retv[(*length)].info = NULL;
|
||||
retv[(*length)].icon_fetch_uid = 0;
|
||||
retv[(*length)].nonselectable = FALSE;
|
||||
if (buf_length > 0 && (read_length > (ssize_t)buf_length)) {
|
||||
dmenuscript_parse_entry_extras(sw, &(retv[(*length)]),
|
||||
buffer + buf_length,
|
||||
read_length - buf_length);
|
||||
if (retv) {
|
||||
size_t buf_length = strlen(buffer) + 1;
|
||||
retv[(*length)].entry = g_memdup(buffer, buf_length);
|
||||
retv[(*length)].icon_name = NULL;
|
||||
retv[(*length)].meta = NULL;
|
||||
retv[(*length)].info = NULL;
|
||||
retv[(*length)].icon_fetch_uid = 0;
|
||||
retv[(*length)].nonselectable = FALSE;
|
||||
if (buf_length > 0 && (read_length > (ssize_t)buf_length)) {
|
||||
dmenuscript_parse_entry_extras(sw, &(retv[(*length)]),
|
||||
buffer + buf_length,
|
||||
read_length - buf_length);
|
||||
}
|
||||
retv[(*length) + 1].entry = NULL;
|
||||
(*length)++;
|
||||
}
|
||||
retv[(*length) + 1].entry = NULL;
|
||||
(*length)++;
|
||||
}
|
||||
}
|
||||
if (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
|
||||
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));
|
||||
mon->w = xcb->screen->width_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) {
|
||||
if (mon == NULL) {
|
||||
g_error("%s: mon == NULL", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
xcb_window_t root = xcb->screen->root;
|
||||
xcb_get_geometry_cookie_t c = xcb_get_geometry(xcb->connection, id);
|
||||
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;
|
||||
xcb_window_t active_window;
|
||||
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);
|
||||
if (!xcb_ewmh_get_active_window_reply(&xcb->ewmh, awc, &active_window,
|
||||
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) {
|
||||
xcb_window_t root = xcb->screen->root;
|
||||
int x, y;
|
||||
if (mon == NULL) {
|
||||
g_error("%s: mon == NULL", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
g_debug("Monitor id: %d", mon_id);
|
||||
// At mouse position.
|
||||
if (mon_id == -3) {
|
||||
|
@ -955,6 +971,10 @@ workarea mon_cache = {
|
|||
0,
|
||||
};
|
||||
int monitor_active(workarea *mon) {
|
||||
if (mon == NULL) {
|
||||
g_error("%s: mon == NULL", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
g_debug("Monitor active");
|
||||
if (mon_set) {
|
||||
if (mon) {
|
||||
|
|
Loading…
Reference in a new issue