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 kill Try killing running instance.
|
||||
* @param kill_running Try killing running instance.
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#ifndef ROFI_MODE_PRIVATE_H
|
||||
#define ROFI_MODE_PRIVATE_H
|
||||
#include "mode.h"
|
||||
#include <gmodule.h>
|
||||
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 match = 1;
|
||||
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};
|
||||
int test = 0;
|
||||
test = helper_token_match(ftokens, esc);
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "modes/drun.h"
|
||||
#include "modes/filebrowser.h"
|
||||
#include "helper.h"
|
||||
#include "history.h"
|
||||
#include "mode-private.h"
|
||||
#include "modes/drun.h"
|
||||
#include "modes/filebrowser.h"
|
||||
#include "rofi.h"
|
||||
#include "settings.h"
|
||||
#include "timings.h"
|
||||
|
@ -1386,7 +1386,7 @@ static int drun_token_match(const Mode *data, rofi_int_matcher **tokens,
|
|||
}
|
||||
int match = 1;
|
||||
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;
|
||||
rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
|
||||
// Match name
|
||||
|
|
|
@ -397,7 +397,7 @@ static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
|||
ScriptModePrivateData *rmpd = sw->private_data;
|
||||
int match = 1;
|
||||
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};
|
||||
int test = 0;
|
||||
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];
|
||||
|
||||
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;
|
||||
// Dirty hack. Normally helper_token_match does _all_ the matching,
|
||||
// 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)) {
|
||||
Property *prop = (Property *)(iter->data);
|
||||
if (prop->type == P_PADDING) {
|
||||
RofiDistance *p = g_new0(RofiDistance, 1);
|
||||
*p = prop->value.padding.left;
|
||||
retv = g_list_append(retv, p);
|
||||
RofiDistance *pnew = g_new0(RofiDistance, 1);
|
||||
*pnew = prop->value.padding.left;
|
||||
retv = g_list_append(retv, pnew);
|
||||
} else if (prop->type == P_INTEGER) {
|
||||
RofiDistance *p = g_new0(RofiDistance, 1);
|
||||
RofiDistance *pnew = g_new0(RofiDistance, 1);
|
||||
RofiDistance d =
|
||||
(RofiDistance){.base = {prop->value.i, ROFI_PU_PX,
|
||||
ROFI_DISTANCE_MODIFIER_NONE, NULL, NULL},
|
||||
.style = ROFI_HL_SOLID};
|
||||
*p = d;
|
||||
retv = g_list_append(retv, p);
|
||||
*pnew = d;
|
||||
retv = g_list_append(retv, pnew);
|
||||
} else {
|
||||
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) {
|
||||
if (tb && tb->cursor >= 0) {
|
||||
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) {
|
||||
|
|
|
@ -63,8 +63,8 @@
|
|||
#include "xcb.h"
|
||||
#include <libsn/sn.h>
|
||||
|
||||
#include "modes/window.h"
|
||||
#include "mode.h"
|
||||
#include "modes/window.h"
|
||||
|
||||
#include <rofi.h>
|
||||
|
||||
|
@ -977,10 +977,8 @@ int monitor_active(workarea *mon) {
|
|||
}
|
||||
g_debug("Monitor active");
|
||||
if (mon_set) {
|
||||
if (mon) {
|
||||
*mon = mon_cache;
|
||||
return TRUE;
|
||||
}
|
||||
*mon = mon_cache;
|
||||
return TRUE;
|
||||
}
|
||||
if (config.monitor != NULL) {
|
||||
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) {
|
||||
for (GList *iter = p->value.list; iter != NULL;
|
||||
iter = g_list_next(iter)) {
|
||||
Property *p = (Property *)iter->data;
|
||||
Property *p2 = (Property *)iter->data;
|
||||
if (value == NULL) {
|
||||
value = g_strdup((char *)(p->value.s));
|
||||
value = g_strdup((char *)(p2->value.s));
|
||||
} else {
|
||||
char *nv = g_strjoin(",", value, (char *)(p->value.s), NULL);
|
||||
char *nv = g_strjoin(",", value, (char *)(p2->value.s), NULL);
|
||||
g_free(value);
|
||||
value = nv;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue