mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Cleanup some duplicate checks.
This commit is contained in:
parent
d623e18fbb
commit
f088d75ee4
10 changed files with 22 additions and 25 deletions
|
@ -149,11 +149,11 @@ int execute_generator(const char *cmd) __attribute__((nonnull));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pidfile The pidfile to create.
|
* @param pidfile The pidfile to create.
|
||||||
* @param kill Try killing running instance.
|
* @param kill_running Try killing running instance.
|
||||||
*
|
*
|
||||||
* returns file descriptor (or -1 when failed)
|
* returns file descriptor (or -1 when failed)
|
||||||
*/
|
*/
|
||||||
int create_pid_file(const char *pidfile, gboolean kill);
|
int create_pid_file(const char *pidfile, gboolean kill_running);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove pid file
|
* Remove pid file
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#ifndef ROFI_MODE_PRIVATE_H
|
#ifndef ROFI_MODE_PRIVATE_H
|
||||||
#define ROFI_MODE_PRIVATE_H
|
#define ROFI_MODE_PRIVATE_H
|
||||||
|
#include "mode.h"
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
|
@ -476,7 +476,7 @@ static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
// int retv = helper_token_match ( tokens, esc );
|
// int retv = helper_token_match ( tokens, esc );
|
||||||
int match = 1;
|
int match = 1;
|
||||||
if (tokens) {
|
if (tokens) {
|
||||||
for (int j = 0; match && tokens != NULL && tokens[j] != NULL; j++) {
|
for (int j = 0; match && tokens[j] != NULL; j++) {
|
||||||
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
||||||
int test = 0;
|
int test = 0;
|
||||||
test = helper_token_match(ftokens, esc);
|
test = helper_token_match(ftokens, esc);
|
||||||
|
|
|
@ -44,11 +44,11 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "modes/drun.h"
|
|
||||||
#include "modes/filebrowser.h"
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "mode-private.h"
|
#include "mode-private.h"
|
||||||
|
#include "modes/drun.h"
|
||||||
|
#include "modes/filebrowser.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timings.h"
|
#include "timings.h"
|
||||||
|
@ -1386,7 +1386,7 @@ static int drun_token_match(const Mode *data, rofi_int_matcher **tokens,
|
||||||
}
|
}
|
||||||
int match = 1;
|
int match = 1;
|
||||||
if (tokens) {
|
if (tokens) {
|
||||||
for (int j = 0; match && tokens != NULL && tokens[j] != NULL; j++) {
|
for (int j = 0; match && tokens[j] != NULL; j++) {
|
||||||
int test = 0;
|
int test = 0;
|
||||||
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
||||||
// Match name
|
// Match name
|
||||||
|
|
|
@ -397,7 +397,7 @@ static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
ScriptModePrivateData *rmpd = sw->private_data;
|
ScriptModePrivateData *rmpd = sw->private_data;
|
||||||
int match = 1;
|
int match = 1;
|
||||||
if (tokens) {
|
if (tokens) {
|
||||||
for (int j = 0; match && tokens != NULL && tokens[j] != NULL; j++) {
|
for (int j = 0; match && tokens[j] != NULL; j++) {
|
||||||
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
||||||
int test = 0;
|
int test = 0;
|
||||||
test = helper_token_match(ftokens, rmpd->cmd_list[index].entry);
|
test = helper_token_match(ftokens, rmpd->cmd_list[index].entry);
|
||||||
|
|
|
@ -418,7 +418,7 @@ static int window_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
client *c = cache_client->data[idx];
|
client *c = cache_client->data[idx];
|
||||||
|
|
||||||
if (tokens) {
|
if (tokens) {
|
||||||
for (int j = 0; match && tokens != NULL && tokens[j] != NULL; j++) {
|
for (int j = 0; match && tokens[j] != NULL; j++) {
|
||||||
int test = 0;
|
int test = 0;
|
||||||
// Dirty hack. Normally helper_token_match does _all_ the matching,
|
// Dirty hack. Normally helper_token_match does _all_ the matching,
|
||||||
// Now we want it to match only one item at the time.
|
// Now we want it to match only one item at the time.
|
||||||
|
|
|
@ -1235,17 +1235,17 @@ GList *rofi_theme_get_list_distance(const widget *widget,
|
||||||
iter = g_list_next(iter)) {
|
iter = g_list_next(iter)) {
|
||||||
Property *prop = (Property *)(iter->data);
|
Property *prop = (Property *)(iter->data);
|
||||||
if (prop->type == P_PADDING) {
|
if (prop->type == P_PADDING) {
|
||||||
RofiDistance *p = g_new0(RofiDistance, 1);
|
RofiDistance *pnew = g_new0(RofiDistance, 1);
|
||||||
*p = prop->value.padding.left;
|
*pnew = prop->value.padding.left;
|
||||||
retv = g_list_append(retv, p);
|
retv = g_list_append(retv, pnew);
|
||||||
} else if (prop->type == P_INTEGER) {
|
} else if (prop->type == P_INTEGER) {
|
||||||
RofiDistance *p = g_new0(RofiDistance, 1);
|
RofiDistance *pnew = g_new0(RofiDistance, 1);
|
||||||
RofiDistance d =
|
RofiDistance d =
|
||||||
(RofiDistance){.base = {prop->value.i, ROFI_PU_PX,
|
(RofiDistance){.base = {prop->value.i, ROFI_PU_PX,
|
||||||
ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL},
|
ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL},
|
||||||
.style = ROFI_HL_SOLID};
|
.style = ROFI_HL_SOLID};
|
||||||
*p = d;
|
*pnew = d;
|
||||||
retv = g_list_append(retv, p);
|
retv = g_list_append(retv, pnew);
|
||||||
} else {
|
} else {
|
||||||
g_warning("Invalid type detected in list.");
|
g_warning("Invalid type detected in list.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -728,9 +728,7 @@ static void textbox_cursor_del_eol(textbox *tb) {
|
||||||
static void textbox_cursor_del_sol(textbox *tb) {
|
static void textbox_cursor_del_sol(textbox *tb) {
|
||||||
if (tb && tb->cursor >= 0) {
|
if (tb && tb->cursor >= 0) {
|
||||||
int length = tb->cursor;
|
int length = tb->cursor;
|
||||||
if (length >= 0) {
|
textbox_delete(tb, 0, length);
|
||||||
textbox_delete(tb, 0, length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void textbox_cursor_del_word(textbox *tb) {
|
static void textbox_cursor_del_word(textbox *tb) {
|
||||||
|
|
|
@ -63,8 +63,8 @@
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include <libsn/sn.h>
|
#include <libsn/sn.h>
|
||||||
|
|
||||||
#include "modes/window.h"
|
|
||||||
#include "mode.h"
|
#include "mode.h"
|
||||||
|
#include "modes/window.h"
|
||||||
|
|
||||||
#include <rofi.h>
|
#include <rofi.h>
|
||||||
|
|
||||||
|
@ -977,10 +977,8 @@ int monitor_active(workarea *mon) {
|
||||||
}
|
}
|
||||||
g_debug("Monitor active");
|
g_debug("Monitor active");
|
||||||
if (mon_set) {
|
if (mon_set) {
|
||||||
if (mon) {
|
*mon = mon_cache;
|
||||||
*mon = mon_cache;
|
return TRUE;
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (config.monitor != NULL) {
|
if (config.monitor != NULL) {
|
||||||
g_debug("Monitor lookup by name : %s", config.monitor);
|
g_debug("Monitor lookup by name : %s", config.monitor);
|
||||||
|
|
|
@ -625,11 +625,11 @@ static gboolean __config_parser_set_property(XrmOption *option,
|
||||||
if (p->type == P_LIST) {
|
if (p->type == P_LIST) {
|
||||||
for (GList *iter = p->value.list; iter != NULL;
|
for (GList *iter = p->value.list; iter != NULL;
|
||||||
iter = g_list_next(iter)) {
|
iter = g_list_next(iter)) {
|
||||||
Property *p = (Property *)iter->data;
|
Property *p2 = (Property *)iter->data;
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
value = g_strdup((char *)(p->value.s));
|
value = g_strdup((char *)(p2->value.s));
|
||||||
} else {
|
} else {
|
||||||
char *nv = g_strjoin(",", value, (char *)(p->value.s), NULL);
|
char *nv = g_strjoin(",", value, (char *)(p2->value.s), NULL);
|
||||||
g_free(value);
|
g_free(value);
|
||||||
value = nv;
|
value = nv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue