mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Small cleanup
This commit is contained in:
parent
167e9d30ce
commit
8c950a984c
4 changed files with 30 additions and 22 deletions
|
@ -6,4 +6,5 @@ typedef struct _xcb_stuff xcb_stuff;
|
||||||
extern xcb_stuff *xcb;
|
extern xcb_stuff *xcb;
|
||||||
|
|
||||||
xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb );
|
xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb );
|
||||||
|
void xcb_stuff_wipe ( xcb_stuff *xcb );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,14 +65,6 @@
|
||||||
// Pidfile.
|
// Pidfile.
|
||||||
char *pidfile = NULL;
|
char *pidfile = NULL;
|
||||||
const char *cache_dir = NULL;
|
const char *cache_dir = NULL;
|
||||||
struct _xcb_stuff xcb_int = {
|
|
||||||
.connection = NULL,
|
|
||||||
.screen = NULL,
|
|
||||||
.screen_nbr = -1,
|
|
||||||
.sndisplay = NULL,
|
|
||||||
.sncontext = NULL,
|
|
||||||
};
|
|
||||||
xcb_stuff *xcb = &xcb_int;
|
|
||||||
struct xkb_stuff xkb = { NULL };
|
struct xkb_stuff xkb = { NULL };
|
||||||
char *config_path = NULL;
|
char *config_path = NULL;
|
||||||
// Array of modi.
|
// Array of modi.
|
||||||
|
@ -315,19 +307,7 @@ static void cleanup ()
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
}
|
}
|
||||||
// Cleanup
|
// Cleanup
|
||||||
if ( xcb->connection != NULL ) {
|
xcb_stuff_wipe ( xcb );
|
||||||
if ( xcb->sncontext != NULL ) {
|
|
||||||
sn_launchee_context_unref ( xcb->sncontext );
|
|
||||||
xcb->sncontext = NULL;
|
|
||||||
}
|
|
||||||
if ( xcb->sndisplay != NULL ) {
|
|
||||||
sn_display_unref ( xcb->sndisplay );
|
|
||||||
xcb->sndisplay = NULL;
|
|
||||||
}
|
|
||||||
xcb_disconnect ( xcb->connection );
|
|
||||||
xcb->connection = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cleaning up memory allocated by the Xresources file.
|
// Cleaning up memory allocated by the Xresources file.
|
||||||
config_xresource_free ();
|
config_xresource_free ();
|
||||||
for ( unsigned int i = 0; i < num_modi; i++ ) {
|
for ( unsigned int i = 0; i < num_modi; i++ ) {
|
||||||
|
|
|
@ -1822,4 +1822,3 @@ Mode * rofi_view_get_mode ( RofiViewState *state )
|
||||||
return state->sw;
|
return state->sw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,16 @@
|
||||||
#include "x11-helper.h"
|
#include "x11-helper.h"
|
||||||
#include "xkb-internal.h"
|
#include "xkb-internal.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct _xcb_stuff xcb_int = {
|
||||||
|
.connection = NULL,
|
||||||
|
.screen = NULL,
|
||||||
|
.screen_nbr = -1,
|
||||||
|
.sndisplay = NULL,
|
||||||
|
.sncontext = NULL,
|
||||||
|
};
|
||||||
|
xcb_stuff *xcb = &xcb_int;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
X11MOD_SHIFT,
|
X11MOD_SHIFT,
|
||||||
|
@ -672,3 +682,21 @@ xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb )
|
||||||
{
|
{
|
||||||
return xcb->screen->root;
|
return xcb->screen->root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xcb_stuff_wipe ( xcb_stuff *xcb )
|
||||||
|
{
|
||||||
|
if ( xcb->connection != NULL ) {
|
||||||
|
if ( xcb->sncontext != NULL ) {
|
||||||
|
sn_launchee_context_unref ( xcb->sncontext );
|
||||||
|
xcb->sncontext = NULL;
|
||||||
|
}
|
||||||
|
if ( xcb->sndisplay != NULL ) {
|
||||||
|
sn_display_unref ( xcb->sndisplay );
|
||||||
|
xcb->sndisplay = NULL;
|
||||||
|
}
|
||||||
|
xcb_disconnect ( xcb->connection );
|
||||||
|
xcb->connection = NULL;
|
||||||
|
xcb->screen = NULL;
|
||||||
|
xcb->screen_nbr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue