Run indenter

This commit is contained in:
Dave Davenport 2016-02-28 15:32:53 +01:00
parent 6fb94876ca
commit a4fd907fe8
11 changed files with 280 additions and 282 deletions

View File

@ -137,7 +137,7 @@ void remove_pid_file ( int fd );
*
* This functions exits the program with 1 when it finds an invalid configuration.
*/
int config_sanity_check ( xcb_connection_t *xcb_connection);
int config_sanity_check ( xcb_connection_t *xcb_connection );
/**
* @param arg string to parse.

View File

@ -32,9 +32,9 @@ void window_set_atom_prop ( xcb_connection_t *xcb_connection, xcb_window_t w, xc
#define ATOM_CHAR( x ) # x
// usable space on a monitor
#define EWMH_ATOMS( X ) \
X ( _NET_WM_WINDOW_OPACITY ), \
X ( I3_SOCKET_PATH ), \
#define EWMH_ATOMS( X ) \
X ( _NET_WM_WINDOW_OPACITY ), \
X ( I3_SOCKET_PATH ), \
X ( WM_WINDOW_ROLE )
enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };

View File

@ -54,34 +54,34 @@
#define CLIENTWINDOWTYPE 10
#define CLIENTROLE 50
extern xcb_connection_t *xcb_connection;
extern xcb_connection_t *xcb_connection;
extern xcb_ewmh_connection_t xcb_ewmh;
extern xcb_screen_t *xcb_screen;
extern int xcb_screen_nbr;
extern xcb_screen_t *xcb_screen;
extern int xcb_screen_nbr;
// a manageable window
typedef struct
{
xcb_window_t window;
xcb_window_t window;
xcb_get_window_attributes_reply_t xattr;
char *title;
char *class;
char *name;
char *role;
int states;
xcb_atom_t state[CLIENTSTATE];
int window_types;
xcb_atom_t window_type[CLIENTWINDOWTYPE];
int active;
int demands;
long hint_flags;
char *title;
char *class;
char *name;
char *role;
int states;
xcb_atom_t state[CLIENTSTATE];
int window_types;
xcb_atom_t window_type[CLIENTWINDOWTYPE];
int active;
int demands;
long hint_flags;
} client;
// window lists
typedef struct
{
xcb_window_t *array;
client **data;
int len;
client **data;
int len;
} winlist;
winlist *cache_client = NULL;
@ -207,9 +207,8 @@ static void x11_cache_free ( void )
*/
static xcb_get_window_attributes_reply_t * window_get_attributes ( xcb_connection_t *xcb_connection, xcb_window_t w )
{
xcb_get_window_attributes_cookie_t c = xcb_get_window_attributes(xcb_connection, w);
xcb_get_window_attributes_reply_t *r = xcb_get_window_attributes_reply ( xcb_connection, c, NULL);
xcb_get_window_attributes_cookie_t c = xcb_get_window_attributes ( xcb_connection, w );
xcb_get_window_attributes_reply_t *r = xcb_get_window_attributes_reply ( xcb_connection, c, NULL );
if ( r ) {
return r;
}
@ -261,38 +260,37 @@ static client* window_client ( xcb_connection_t *xcb_connection, xcb_window_t wi
// copy xattr so we don't have to care when stuff is freed
memmove ( &c->xattr, attr, sizeof ( xcb_get_window_attributes_reply_t ) );
xcb_get_property_cookie_t cky = xcb_ewmh_get_wm_state(&xcb_ewmh, win);
xcb_get_property_cookie_t cky = xcb_ewmh_get_wm_state ( &xcb_ewmh, win );
xcb_ewmh_get_atoms_reply_t states;
if(xcb_ewmh_get_wm_state_reply( &xcb_ewmh, cky, &states, NULL)){
c->states = MIN(CLIENTSTATE,states.atoms_len);
memcpy(c->state, states.atoms, MIN(CLIENTSTATE, states.atoms_len));
xcb_ewmh_get_atoms_reply_wipe(&states);
if ( xcb_ewmh_get_wm_state_reply ( &xcb_ewmh, cky, &states, NULL ) ) {
c->states = MIN ( CLIENTSTATE, states.atoms_len );
memcpy ( c->state, states.atoms, MIN ( CLIENTSTATE, states.atoms_len ) );
xcb_ewmh_get_atoms_reply_wipe ( &states );
}
cky = xcb_ewmh_get_wm_window_type(&xcb_ewmh, win);
if(xcb_ewmh_get_wm_window_type_reply( &xcb_ewmh, cky, &states, NULL)){
c->window_types= MIN(CLIENTWINDOWTYPE,states.atoms_len);
memcpy(c->window_type, states.atoms, MIN(CLIENTWINDOWTYPE, states.atoms_len));
xcb_ewmh_get_atoms_reply_wipe(&states);
cky = xcb_ewmh_get_wm_window_type ( &xcb_ewmh, win );
if ( xcb_ewmh_get_wm_window_type_reply ( &xcb_ewmh, cky, &states, NULL ) ) {
c->window_types = MIN ( CLIENTWINDOWTYPE, states.atoms_len );
memcpy ( c->window_type, states.atoms, MIN ( CLIENTWINDOWTYPE, states.atoms_len ) );
xcb_ewmh_get_atoms_reply_wipe ( &states );
}
c->title = window_get_text_prop ( xcb_connection, c->window, xcb_ewmh._NET_WM_NAME );
if ( c->title == NULL ) {
c->title = window_get_text_prop ( xcb_connection, c->window, XCB_ATOM_WM_NAME);
c->title = window_get_text_prop ( xcb_connection, c->window, XCB_ATOM_WM_NAME );
}
c->role = window_get_text_prop ( xcb_connection, c->window, netatoms[WM_WINDOW_ROLE] );
cky = xcb_icccm_get_wm_class ( xcb_connection, c->window );
xcb_icccm_get_wm_class_reply_t wcr;
if ( xcb_icccm_get_wm_class_reply (xcb_connection, cky, &wcr, NULL)) {
c->class = g_strdup(wcr.class_name);
xcb_icccm_get_wm_class_reply_wipe (&wcr);
if ( xcb_icccm_get_wm_class_reply ( xcb_connection, cky, &wcr, NULL ) ) {
c->class = g_strdup ( wcr.class_name );
xcb_icccm_get_wm_class_reply_wipe ( &wcr );
}
xcb_get_property_cookie_t cc = xcb_icccm_get_wm_hints ( xcb_connection, c->window);
xcb_icccm_wm_hints_t r;
if (xcb_icccm_get_wm_hints_reply ( xcb_connection, cc, &r, NULL)){
xcb_get_property_cookie_t cc = xcb_icccm_get_wm_hints ( xcb_connection, c->window );
xcb_icccm_wm_hints_t r;
if ( xcb_icccm_get_wm_hints_reply ( xcb_connection, cc, &r, NULL ) ) {
c->hint_flags = r.flags;
}
@ -365,48 +363,48 @@ static unsigned int window_mode_get_num_entries ( const Mode *sw )
}
static void _window_mode_load_data ( Mode *sw, unsigned int cd )
{
ModeModePrivateData *pd = (ModeModePrivateData *) mode_get_private_data ( sw );
ModeModePrivateData *pd = (ModeModePrivateData *) mode_get_private_data ( sw );
// find window list
int nwins = 0;
xcb_window_t wins[100];
xcb_window_t curr_win_id;
xcb_window_t wins[100];
xcb_window_t curr_win_id;
// Create cache
x11_cache_create ();
// Check for i3
pd->config_i3_mode = i3_support_initialize ( xcb_connection );
xcb_get_property_cookie_t c =xcb_ewmh_get_active_window( &xcb_ewmh, xcb_screen_nbr);
if ( !xcb_ewmh_get_active_window_reply ( &xcb_ewmh, c, &curr_win_id, NULL )) {
xcb_get_property_cookie_t c = xcb_ewmh_get_active_window ( &xcb_ewmh, xcb_screen_nbr );
if ( !xcb_ewmh_get_active_window_reply ( &xcb_ewmh, c, &curr_win_id, NULL ) ) {
curr_win_id = 0;
}
// Get the current desktop.
unsigned int current_desktop = 0;
c = xcb_ewmh_get_current_desktop( &xcb_ewmh, xcb_screen_nbr);
if ( !xcb_ewmh_get_current_desktop_reply ( &xcb_ewmh, c, &current_desktop, NULL )){
c = xcb_ewmh_get_current_desktop ( &xcb_ewmh, xcb_screen_nbr );
if ( !xcb_ewmh_get_current_desktop_reply ( &xcb_ewmh, c, &current_desktop, NULL ) ) {
current_desktop = 0;
}
c = xcb_ewmh_get_client_list_stacking ( &xcb_ewmh, 0);
c = xcb_ewmh_get_client_list_stacking ( &xcb_ewmh, 0 );
xcb_ewmh_get_windows_reply_t clients;
if ( xcb_ewmh_get_client_list_stacking_reply ( &xcb_ewmh, c, &clients, NULL)){
nwins = MIN ( 100, clients.windows_len);
memcpy(wins, clients.windows, nwins*sizeof(xcb_window_t) );
xcb_ewmh_get_windows_reply_wipe(&clients);
if ( xcb_ewmh_get_client_list_stacking_reply ( &xcb_ewmh, c, &clients, NULL ) ) {
nwins = MIN ( 100, clients.windows_len );
memcpy ( wins, clients.windows, nwins * sizeof ( xcb_window_t ) );
xcb_ewmh_get_windows_reply_wipe ( &clients );
}
else {
c = xcb_ewmh_get_client_list ( &xcb_ewmh, xcb_screen_nbr);
if ( xcb_ewmh_get_client_list_reply ( &xcb_ewmh, c, &clients, NULL)) {
nwins = MIN ( 100, clients.windows_len);
memcpy(wins, clients.windows, nwins*sizeof(xcb_window_t) );
xcb_ewmh_get_windows_reply_wipe(&clients);
c = xcb_ewmh_get_client_list ( &xcb_ewmh, xcb_screen_nbr );
if ( xcb_ewmh_get_client_list_reply ( &xcb_ewmh, c, &clients, NULL ) ) {
nwins = MIN ( 100, clients.windows_len );
memcpy ( wins, clients.windows, nwins * sizeof ( xcb_window_t ) );
xcb_ewmh_get_windows_reply_wipe ( &clients );
}
}
if ( nwins > 0 ) {
char pattern[50];
int i;
unsigned int classfield = 0;
unsigned int desktops = 0;
char pattern[50];
int i;
unsigned int classfield = 0;
unsigned int desktops = 0;
// windows we actually display. May be slightly different to _NET_CLIENT_LIST_STACKING
// if we happen to have a window destroyed while we're working...
pd->ids = winlist_new ();
@ -425,7 +423,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
if ( client_has_state ( c, xcb_ewmh._NET_WM_STATE_DEMANDS_ATTENTION ) ) {
c->demands = TRUE;
}
if ( ( c->hint_flags & XCB_ICCCM_WM_HINT_X_URGENCY ) != 0) {
if ( ( c->hint_flags & XCB_ICCCM_WM_HINT_X_URGENCY ) != 0 ) {
c->demands = TRUE;
}
@ -437,9 +435,9 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
}
// Create pattern for printing the line.
xcb_get_property_cookie_t c = xcb_ewmh_get_number_of_desktops( &xcb_ewmh, xcb_screen_nbr);
if ( !xcb_ewmh_get_number_of_desktops_reply ( &xcb_ewmh, c, &desktops, NULL )){
desktops= 1;
xcb_get_property_cookie_t c = xcb_ewmh_get_number_of_desktops ( &xcb_ewmh, xcb_screen_nbr );
if ( !xcb_ewmh_get_number_of_desktops_reply ( &xcb_ewmh, c, &desktops, NULL ) ) {
desktops = 1;
}
if ( pd->config_i3_mode ) {
@ -454,36 +452,38 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
// build the actual list
for ( i = 0; i < ( pd->ids->len ); i++ ) {
xcb_window_t w = pd->ids->array[i];
client *c;
client *c;
if ( ( c = window_client ( xcb_connection, w ) ) ) {
// final line format
unsigned int wmdesktop;
char desktop[5];
char desktop[5];
desktop[0] = 0;
size_t len =
size_t len =
( ( c->title != NULL ) ? strlen ( c->title ) : 0 ) + ( c->class ? strlen ( c->class ) : 0 ) + classfield + 50;
char *line = g_malloc ( len );
char *line = g_malloc ( len );
if ( !pd->config_i3_mode ) {
// find client's desktop.
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *r;
xcb_get_property_reply_t *r;
cookie = xcb_get_property(xcb_connection, 0, c->window, xcb_ewmh._NET_WM_DESKTOP, XCB_GET_PROPERTY, 0, sizeof(unsigned int));
r = xcb_get_property_reply(xcb_connection, cookie, NULL);
if ( r&& r->type == XCB_ATOM_INTEGER){
wmdesktop = *((int *)xcb_get_property_value(r));
cookie =
xcb_get_property ( xcb_connection, 0, c->window, xcb_ewmh._NET_WM_DESKTOP, XCB_GET_PROPERTY, 0,
sizeof ( unsigned int ) );
r = xcb_get_property_reply ( xcb_connection, cookie, NULL );
if ( r && r->type == XCB_ATOM_INTEGER ) {
wmdesktop = *( (int *) xcb_get_property_value ( r ) );
}
if ( r&&r->type != XCB_ATOM_INTEGER) {
if ( r && r->type != XCB_ATOM_INTEGER ) {
// Assume the client is on all desktops.
wmdesktop = 0xFFFFFFFF;
}
else if ( cd && wmdesktop != current_desktop ) {
g_free ( line );
free(r);
free ( r );
continue;
}
free(r);
free ( r );
if ( wmdesktop < 0xFFFFFFFF ) {
snprintf ( desktop, 5, "%d", (int) wmdesktop );
@ -539,9 +539,9 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
}
else{
xcb_ewmh_request_change_active_window ( &xcb_ewmh, xcb_screen_nbr, rmpd->ids->array[selected_line],
XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER ,
XCB_CURRENT_TIME, XCB_WINDOW_NONE);
xcb_flush(xcb_connection);
XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER,
XCB_CURRENT_TIME, XCB_WINDOW_NONE );
xcb_flush ( xcb_connection );
}
}
return retv;

View File

@ -47,9 +47,9 @@
#include "view.h"
extern xcb_connection_t *xcb_connection;
extern xcb_screen_t *xcb_screen;
static int stored_argc = 0;
static char **stored_argv = NULL;
extern xcb_screen_t *xcb_screen;
static int stored_argc = 0;
static char **stored_argv = NULL;
void cmd_set_arguments ( int argc, char **argv )
{
@ -511,7 +511,7 @@ void remove_pid_file ( int fd )
*
* This functions exits the program with 1 when it finds an invalid configuration.
*/
int config_sanity_check ( xcb_connection_t* xcb_connection)
int config_sanity_check ( xcb_connection_t* xcb_connection )
{
// If alternative row is not set, copy the normal background color.
// Do this at the beginning as we might use it in the error dialog.

View File

@ -45,7 +45,7 @@
#ifdef HAVE_I3_IPC_H
#include <i3/ipc.h>
// Path to HAVE_I3_IPC_H socket.
char *i3_socket_path = NULL;
char *i3_socket_path = NULL;
extern xcb_screen_t *xcb_screen;
void i3_support_focus_window ( xcb_window_t id )
@ -119,7 +119,7 @@ int i3_support_initialize ( xcb_connection_t *xcb_connection )
i3_support_free_internals ();
// Get atom for I3_SOCKET_PATH
i3_socket_path = window_get_text_prop ( xcb_connection, xcb_screen->root, netatoms[I3_SOCKET_PATH]);
i3_socket_path = window_get_text_prop ( xcb_connection, xcb_screen->root, netatoms[I3_SOCKET_PATH] );
// If we find it, go into i3 mode.
return ( i3_socket_path != NULL ) ? TRUE : FALSE;
}

View File

@ -64,30 +64,30 @@
#include "xkb-internal.h"
// Pidfile.
char *pidfile = NULL;
const char *cache_dir = NULL;
SnDisplay *sndisplay = NULL;
SnLauncheeContext *sncontext = NULL;
xcb_connection_t *xcb_connection = NULL;
char *pidfile = NULL;
const char *cache_dir = NULL;
SnDisplay *sndisplay = NULL;
SnLauncheeContext *sncontext = NULL;
xcb_connection_t *xcb_connection = NULL;
xcb_ewmh_connection_t xcb_ewmh;
xcb_screen_t *xcb_screen = NULL;
int xcb_screen_nbr = -1;
struct xkb_stuff xkb = { NULL };
char *display_str = NULL;
char *config_path = NULL;
xcb_screen_t *xcb_screen = NULL;
int xcb_screen_nbr = -1;
struct xkb_stuff xkb = { NULL };
char *display_str = NULL;
char *config_path = NULL;
// Array of modi.
Mode **modi = NULL;
unsigned int num_modi = 0;
Mode **modi = NULL;
unsigned int num_modi = 0;
// Current selected switcher.
unsigned int curr_switcher = 0;
unsigned int curr_switcher = 0;
GMainLoop *main_loop = NULL;
GWaterXcbSource *main_loop_source = NULL;
gboolean quiet = FALSE;
GMainLoop *main_loop = NULL;
GWaterXcbSource *main_loop_source = NULL;
gboolean quiet = FALSE;
static int dmenu_mode = FALSE;
static int dmenu_mode = FALSE;
int return_code = EXIT_SUCCESS;
int return_code = EXIT_SUCCESS;
void process_result ( RofiViewState *state );
void process_result_error ( RofiViewState *state );
@ -324,7 +324,7 @@ static void cleanup ()
sn_display_unref ( sndisplay );
sndisplay = NULL;
}
xcb_disconnect( xcb_connection );
xcb_disconnect ( xcb_connection );
xcb_connection = NULL;
}
@ -473,7 +473,6 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
return G_SOURCE_CONTINUE;
}
static gboolean main_loop_signal_handler_int ( G_GNUC_UNUSED gpointer data )
{
// Break out of loop.
@ -494,7 +493,7 @@ static void error_trap_pop ( G_GNUC_UNUSED SnDisplay *display, xcb_connection_t
exit ( EXIT_FAILURE );
}
xcb_flush(xdisplay);
xcb_flush ( xdisplay );
--error_trap_depth;
}
@ -506,7 +505,7 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
char *msg = NULL;
//
// Sanity check
if ( config_sanity_check ( xcb_connection) ) {
if ( config_sanity_check ( xcb_connection ) ) {
return G_SOURCE_REMOVE;
}
TICK_N ( "Config sanity check" );
@ -632,16 +631,15 @@ int main ( int argc, char *argv[] )
xcb_connection = xcb_connect ( display_str, &xcb_screen_nbr );
TICK_N ( "Open Display" );
xcb_screen = xcb_aux_get_screen ( xcb_connection, xcb_screen_nbr );
xcb_screen = xcb_aux_get_screen ( xcb_connection, xcb_screen_nbr );
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms(xcb_connection, &xcb_ewmh);
xcb_generic_error_t **errors = NULL;
xcb_ewmh_init_atoms_replies(&xcb_ewmh, ac, errors);
if (errors){
fprintf(stderr, "Failed to create EWMH atoms\n");
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms ( xcb_connection, &xcb_ewmh );
xcb_generic_error_t **errors = NULL;
xcb_ewmh_init_atoms_replies ( &xcb_ewmh, ac, errors );
if ( errors ) {
fprintf ( stderr, "Failed to create EWMH atoms\n" );
}
if ( xkb_x11_setup_xkb_extension ( xcb_connection, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION,
XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS, NULL, NULL, &xkb.first_event, NULL ) < 0 ) {
fprintf ( stderr, "cannot setup XKB extension!\n" );
@ -712,7 +710,7 @@ int main ( int argc, char *argv[] )
sndisplay = sn_xcb_display_new ( xcb_connection, error_trap_push, error_trap_pop );
if ( sndisplay != NULL ) {
sncontext = sn_launchee_context_new_from_environment ( sndisplay, xcb_screen_nbr);
sncontext = sn_launchee_context_new_from_environment ( sndisplay, xcb_screen_nbr );
}
TICK_N ( "Startup Notification" );

View File

@ -62,18 +62,18 @@
#include "view-internal.h"
// What todo with these.
extern xcb_connection_t *xcb_connection;
extern xcb_screen_t *xcb_screen;
extern SnLauncheeContext *sncontext;
extern xcb_connection_t *xcb_connection;
extern xcb_screen_t *xcb_screen;
extern SnLauncheeContext *sncontext;
extern xcb_ewmh_connection_t xcb_ewmh;
GThreadPool *tpool = NULL;
GThreadPool *tpool = NULL;
RofiViewState *current_active_menu = NULL;
xcb_window_t main_window = XCB_WINDOW_NONE;
cairo_surface_t *surface = NULL;
cairo_surface_t *fake_bg = NULL;
cairo_t *draw = NULL;
RofiViewState *current_active_menu = NULL;
xcb_window_t main_window = XCB_WINDOW_NONE;
cairo_surface_t *surface = NULL;
cairo_surface_t *fake_bg = NULL;
cairo_t *draw = NULL;
static char * get_matching_state ( void )
{
@ -388,32 +388,33 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *event, xkb
}
}
}
else{ switch ( type )
{
case XCB_EXPOSE:
state->update = TRUE;
break;
case XCB_CONFIGURE_NOTIFY:
{
xcb_configure_notify_event_t *xce = (xcb_configure_notify_event_t *) event;
if ( xce->window == main_window ) {
if ( state->x != xce->x || state->y != xce->y ) {
state->x = xce->x;
state->y = xce->y;
state->update = TRUE;
}
if ( state->w != xce->width || state->h != xce->height ) {
state->w = xce->width;
state->h = xce->height;
cairo_xcb_surface_set_size ( surface, state->w, state->h );
rofi_view_resize ( state );
}
}
break;
}
default:
state->x11_event_loop ( state, event, xkb );
}
else{
switch ( type )
{
case XCB_EXPOSE:
state->update = TRUE;
break;
case XCB_CONFIGURE_NOTIFY:
{
xcb_configure_notify_event_t *xce = (xcb_configure_notify_event_t *) event;
if ( xce->window == main_window ) {
if ( state->x != xce->x || state->y != xce->y ) {
state->x = xce->x;
state->y = xce->y;
state->update = TRUE;
}
if ( state->w != xce->width || state->h != xce->height ) {
state->w = xce->width;
state->h = xce->height;
cairo_xcb_surface_set_size ( surface, state->w, state->h );
rofi_view_resize ( state );
}
}
break;
}
default:
state->x11_event_loop ( state, event, xkb );
}
}
rofi_view_update ( state );
}
@ -492,7 +493,7 @@ static xcb_window_t __create_window ( xcb_connection_t *xcb_connection, xcb_scre
{ 0,
0,
XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_BUTTON_1_MOTION,map };
XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_BUTTON_1_MOTION, map };
xcb_window_t box = xcb_generate_id ( xcb_connection );
xcb_create_window ( xcb_connection,
@ -540,8 +541,8 @@ static xcb_window_t __create_window ( xcb_connection_t *xcb_connection, xcb_scre
// // make it an unmanaged window
if ( ( ( menu_flags & MENU_NORMAL_WINDOW ) == 0 ) && !config.fullscreen ) {
window_set_atom_prop ( xcb_connection, box, xcb_ewmh._NET_WM_STATE, &xcb_ewmh._NET_WM_STATE_ABOVE, 1 );
uint32_t values[] = {1};
xcb_change_window_attributes ( xcb_connection, box, XCB_CW_OVERRIDE_REDIRECT, values);
uint32_t values[] = { 1 };
xcb_change_window_attributes ( xcb_connection, box, XCB_CW_OVERRIDE_REDIRECT, values );
}
else{
window_set_atom_prop ( xcb_connection, box, xcb_ewmh._NET_WM_WINDOW_TYPE, &xcb_ewmh._NET_WM_WINDOW_TYPE_NORMAL, 1 );
@ -555,8 +556,8 @@ static xcb_window_t __create_window ( xcb_connection_t *xcb_connection, xcb_scre
}
// Set the WM_NAME
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, box, xcb_ewmh._NET_WM_NAME, xcb_ewmh.UTF8_STRING, 8, 4,"rofi");
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, box, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, 4,"rofi");
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, box, xcb_ewmh._NET_WM_NAME, xcb_ewmh.UTF8_STRING, 8, 4, "rofi" );
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, box, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, 4, "rofi" );
x11_set_window_opacity ( xcb_connection, box, config.window_opacity );
return box;
@ -994,9 +995,10 @@ void rofi_view_update ( RofiViewState *state )
*/
static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t *xse )
{
if ( xse->property == XCB_ATOM_NONE ){
if ( xse->property == XCB_ATOM_NONE ) {
fprintf ( stderr, "Failed to convert selection\n" );
} else if ( xse->property == xcb_ewmh.UTF8_STRING ) {
}
else if ( xse->property == xcb_ewmh.UTF8_STRING ) {
gchar *text = window_get_text_prop ( xcb_connection, main_window, xcb_ewmh.UTF8_STRING );
if ( text != NULL && text[0] != '\0' ) {
unsigned int dl = strlen ( text );
@ -1013,7 +1015,8 @@ static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t
state->refilter = TRUE;
}
g_free ( text );
} else {
}
else {
fprintf ( stderr, "Failed\n" );
}
}
@ -1343,12 +1346,12 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t
// Handling of paste
if ( abe_test_action ( PASTE_PRIMARY, modstate, key ) ) {
xcb_convert_selection ( xcb_connection, main_window, XCB_ATOM_PRIMARY,
xcb_ewmh.UTF8_STRING,xcb_ewmh.UTF8_STRING, XCB_CURRENT_TIME );
xcb_ewmh.UTF8_STRING, xcb_ewmh.UTF8_STRING, XCB_CURRENT_TIME );
xcb_flush ( xcb_connection );
}
else if ( abe_test_action ( PASTE_SECONDARY, modstate, key ) ) {
xcb_convert_selection ( xcb_connection, main_window, XCB_ATOM_SECONDARY,
xcb_ewmh.UTF8_STRING,xcb_ewmh.UTF8_STRING, XCB_CURRENT_TIME );
xcb_ewmh.UTF8_STRING, xcb_ewmh.UTF8_STRING, XCB_CURRENT_TIME );
xcb_flush ( xcb_connection );
}
if ( abe_test_action ( SCREENSHOT, modstate, key ) ) {

View File

@ -62,29 +62,29 @@ enum
NUM_X11MOD
};
xcb_depth_t *depth = NULL;
xcb_visualtype_t *visual = NULL;
xcb_colormap_t map = XCB_COLORMAP_NONE;
xcb_depth_t *root_depth = NULL;
xcb_visualtype_t *root_visual = NULL;
xcb_atom_t netatoms[NUM_NETATOMS];
const char *netatom_names[] = { EWMH_ATOMS ( ATOM_CHAR ) };
static unsigned int x11_mod_masks[NUM_X11MOD];
xcb_depth_t *depth = NULL;
xcb_visualtype_t *visual = NULL;
xcb_colormap_t map = XCB_COLORMAP_NONE;
xcb_depth_t *root_depth = NULL;
xcb_visualtype_t *root_visual = NULL;
xcb_atom_t netatoms[NUM_NETATOMS];
const char *netatom_names[] = { EWMH_ATOMS ( ATOM_CHAR ) };
static unsigned int x11_mod_masks[NUM_X11MOD];
extern xcb_ewmh_connection_t xcb_ewmh;
extern xcb_connection_t *xcb_connection;
extern xcb_connection_t *xcb_connection;
// retrieve a text property from a window
// technically we could use window_get_prop(), but this is better for character set support
char* window_get_text_prop ( xcb_connection_t *xcb_connection, xcb_window_t w, xcb_atom_t atom )
{
xcb_get_property_cookie_t c = xcb_get_property( xcb_connection, 0, w, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX);
xcb_get_property_reply_t *r = xcb_get_property_reply( xcb_connection, c, NULL);
if ( r ){
char *str = g_malloc ( xcb_get_property_value_length(r)+1);
memcpy(str, xcb_get_property_value(r), xcb_get_property_value_length(r));
str[xcb_get_property_value_length(r)] = '\0';
free(r);
xcb_get_property_cookie_t c = xcb_get_property ( xcb_connection, 0, w, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX );
xcb_get_property_reply_t *r = xcb_get_property_reply ( xcb_connection, c, NULL );
if ( r ) {
char *str = g_malloc ( xcb_get_property_value_length ( r ) + 1 );
memcpy ( str, xcb_get_property_value ( r ), xcb_get_property_value_length ( r ) );
str[xcb_get_property_value_length ( r )] = '\0';
free ( r );
return str;
}
return NULL;
@ -92,43 +92,43 @@ char* window_get_text_prop ( xcb_connection_t *xcb_connection, xcb_window_t w, x
void window_set_atom_prop ( xcb_connection_t *xcb_connection, xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms, int count )
{
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, w, prop, XCB_ATOM_ATOM, 32, count, atoms);
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, w, prop, XCB_ATOM_ATOM, 32, count, atoms );
}
extern xcb_screen_t *xcb_screen;
extern int xcb_screen_nbr;
extern int xcb_screen_nbr;
int monitor_get_smallest_size ( xcb_connection_t *xcb_connection )
{
xcb_generic_error_t *error;
int size = MIN (xcb_screen->width_in_pixels, xcb_screen->height_in_pixels);
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active(xcb_connection);
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply(xcb_connection, is_active_req, &error);
if (error) {
fprintf(stderr, "Couldn't query Xinerama\n");
xcb_generic_error_t *error;
int size = MIN ( xcb_screen->width_in_pixels, xcb_screen->height_in_pixels );
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active ( xcb_connection );
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply ( xcb_connection, is_active_req, &error );
if ( error ) {
fprintf ( stderr, "Couldn't query Xinerama\n" );
return size;
}
if (!is_active->state) {
if ( !is_active->state ) {
free ( is_active );
return size;
}
free ( is_active );
xcb_xinerama_query_screens_cookie_t cookie_screen;
cookie_screen = xcb_xinerama_query_screens(xcb_connection);
xcb_xinerama_query_screens_reply_t *query_screens;
query_screens = xcb_xinerama_query_screens_reply(xcb_connection, cookie_screen, &error);
if (error) {
fprintf(stderr, "Error getting screen info\n");
cookie_screen = xcb_xinerama_query_screens ( xcb_connection );
xcb_xinerama_query_screens_reply_t *query_screens;
query_screens = xcb_xinerama_query_screens_reply ( xcb_connection, cookie_screen, &error );
if ( error ) {
fprintf ( stderr, "Error getting screen info\n" );
return size;
}
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info(query_screens);
int len = xcb_xinerama_query_screens_screen_info_length(query_screens);
for (int i = 0; i < len; i++) {
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info ( query_screens );
int len = xcb_xinerama_query_screens_screen_info_length ( query_screens );
for ( int i = 0; i < len; i++ ) {
xcb_xinerama_screen_info_t *info = &screens[i];
size = MIN ( info->width, size );
size = MIN ( info->height, size );
size = MIN ( info->width, size );
size = MIN ( info->height, size );
}
free(query_screens);
free ( query_screens );
return size;
}
@ -137,40 +137,40 @@ int monitor_get_dimension ( xcb_connection_t *xcb_connection, xcb_screen_t *scre
xcb_generic_error_t *error = NULL;
memset ( mon, 0, sizeof ( workarea ) );
mon->w = screen->width_in_pixels;
mon->h = screen->height_in_pixels;
mon->h = screen->height_in_pixels;
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active(xcb_connection);
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply(xcb_connection, is_active_req, &error);
if (error) {
fprintf(stderr, "Error getting screen info\n");
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active ( xcb_connection );
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply ( xcb_connection, is_active_req, &error );
if ( error ) {
fprintf ( stderr, "Error getting screen info\n" );
return FALSE;
}
if (!is_active->state) {
if ( !is_active->state ) {
free ( is_active );
return FALSE;
}
free ( is_active );
xcb_xinerama_query_screens_cookie_t cookie_screen;
cookie_screen = xcb_xinerama_query_screens(xcb_connection);
xcb_xinerama_query_screens_reply_t *query_screens;
query_screens = xcb_xinerama_query_screens_reply(xcb_connection, cookie_screen, &error);
if (error) {
fprintf(stderr, "Error getting screen info\n");
cookie_screen = xcb_xinerama_query_screens ( xcb_connection );
xcb_xinerama_query_screens_reply_t *query_screens;
query_screens = xcb_xinerama_query_screens_reply ( xcb_connection, cookie_screen, &error );
if ( error ) {
fprintf ( stderr, "Error getting screen info\n" );
return FALSE;
}
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info(query_screens);
int len = xcb_xinerama_query_screens_screen_info_length(query_screens);
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info ( query_screens );
int len = xcb_xinerama_query_screens_screen_info_length ( query_screens );
if ( monitor < len ) {
xcb_xinerama_screen_info_t *info = &screens[monitor];
mon->w = info->width;
mon->h = info->height;
mon->x = info->x_org;
mon->y = info->y_org;
free(query_screens);
free ( query_screens );
return TRUE;
}
free(query_screens);
free ( query_screens );
return FALSE;
}
@ -182,29 +182,29 @@ void monitor_dimensions ( xcb_connection_t *xcb_connection, xcb_screen_t *screen
mon->w = screen->width_in_pixels;
mon->h = screen->height_in_pixels;
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active(xcb_connection);
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply(xcb_connection, is_active_req, &error);
if (error) {
fprintf(stderr, "Couldn't query Xinerama\n");
return ;
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active ( xcb_connection );
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply ( xcb_connection, is_active_req, &error );
if ( error ) {
fprintf ( stderr, "Couldn't query Xinerama\n" );
return;
}
if (!is_active->state) {
if ( !is_active->state ) {
free ( is_active );
return ;
return;
}
free ( is_active );
xcb_xinerama_query_screens_cookie_t cookie_screen;
cookie_screen = xcb_xinerama_query_screens(xcb_connection);
xcb_xinerama_query_screens_reply_t *query_screens;
query_screens = xcb_xinerama_query_screens_reply(xcb_connection, cookie_screen, &error);
if (error) {
fprintf(stderr, "Error getting screen info\n");
return ;
cookie_screen = xcb_xinerama_query_screens ( xcb_connection );
xcb_xinerama_query_screens_reply_t *query_screens;
query_screens = xcb_xinerama_query_screens_reply ( xcb_connection, cookie_screen, &error );
if ( error ) {
fprintf ( stderr, "Error getting screen info\n" );
return;
}
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info(query_screens);
int len = xcb_xinerama_query_screens_screen_info_length(query_screens);
for ( int i = 0; i < len; i++){
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info ( query_screens );
int len = xcb_xinerama_query_screens_screen_info_length ( query_screens );
for ( int i = 0; i < len; i++ ) {
xcb_xinerama_screen_info_t *info = &screens[i];
if ( INTERSECT ( x, y, 1, 1, info->x_org, info->y_org, info->width, info->height ) ) {
mon->w = info->width;
@ -214,7 +214,7 @@ void monitor_dimensions ( xcb_connection_t *xcb_connection, xcb_screen_t *screen
break;
}
}
free(query_screens);
free ( query_screens );
}
/**
@ -229,12 +229,12 @@ static int pointer_get ( xcb_connection_t *xcb_connection, xcb_window_t root, in
{
*x = 0;
*y = 0;
xcb_query_pointer_cookie_t c = xcb_query_pointer ( xcb_connection, root );
xcb_query_pointer_reply_t *r = xcb_query_pointer_reply ( xcb_connection, c, NULL );
xcb_query_pointer_cookie_t c = xcb_query_pointer ( xcb_connection, root );
xcb_query_pointer_reply_t *r = xcb_query_pointer_reply ( xcb_connection, c, NULL );
if ( r ) {
*x = r->root_x;
*y = r->root_y;
free(r);
free ( r );
return 1;
}
@ -245,7 +245,7 @@ static int pointer_get ( xcb_connection_t *xcb_connection, xcb_window_t root, in
void monitor_active ( xcb_connection_t *xcb_connection, workarea *mon )
{
xcb_window_t root = xcb_screen->root;
int x, y;
int x, y;
if ( config.monitor >= 0 ) {
if ( monitor_get_dimension ( xcb_connection, xcb_screen, config.monitor, mon ) ) {
@ -256,31 +256,32 @@ void monitor_active ( xcb_connection_t *xcb_connection, workarea *mon )
// Get the current desktop.
unsigned int current_desktop = 0;
if ( config.monitor != -2 && xcb_ewmh_get_current_desktop_reply ( &xcb_ewmh,
xcb_ewmh_get_current_desktop( &xcb_ewmh, xcb_screen_nbr), &current_desktop, NULL )) {
xcb_get_property_cookie_t c = xcb_ewmh_get_desktop_viewport(&xcb_ewmh, xcb_screen_nbr);
xcb_ewmh_get_desktop_viewport_reply_t vp;
if ( xcb_ewmh_get_desktop_viewport_reply ( &xcb_ewmh, c, &vp, NULL)){
if ( current_desktop < vp.desktop_viewport_len) {
monitor_dimensions ( xcb_connection, xcb_screen, vp.desktop_viewport[current_desktop].x,
vp.desktop_viewport[current_desktop].y, mon );
xcb_ewmh_get_desktop_viewport_reply_wipe(&vp);
return;
}
xcb_ewmh_get_desktop_viewport_reply_wipe(&vp);
xcb_ewmh_get_current_desktop ( &xcb_ewmh, xcb_screen_nbr ),
&current_desktop, NULL ) ) {
xcb_get_property_cookie_t c = xcb_ewmh_get_desktop_viewport ( &xcb_ewmh, xcb_screen_nbr );
xcb_ewmh_get_desktop_viewport_reply_t vp;
if ( xcb_ewmh_get_desktop_viewport_reply ( &xcb_ewmh, c, &vp, NULL ) ) {
if ( current_desktop < vp.desktop_viewport_len ) {
monitor_dimensions ( xcb_connection, xcb_screen, vp.desktop_viewport[current_desktop].x,
vp.desktop_viewport[current_desktop].y, mon );
xcb_ewmh_get_desktop_viewport_reply_wipe ( &vp );
return;
}
xcb_ewmh_get_desktop_viewport_reply_wipe ( &vp );
}
}
xcb_window_t active_window;
if ( xcb_ewmh_get_active_window_reply ( &xcb_ewmh,
xcb_ewmh_get_active_window( &xcb_ewmh, xcb_screen_nbr), &active_window, NULL )) {
xcb_ewmh_get_active_window ( &xcb_ewmh, xcb_screen_nbr ), &active_window, NULL ) ) {
// get geometry.
xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb_connection, active_window);
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb_connection, c, NULL);
xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb_connection, active_window );
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb_connection, c, NULL );
if ( r ) {
if ( config.monitor == -2 ) {
xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates(xcb_connection, active_window, root, r->x, r->y);
xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply (xcb_connection, ct, NULL);
if ( t ){
xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates ( xcb_connection, active_window, root, r->x, r->y );
xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply ( xcb_connection, ct, NULL );
if ( t ) {
// place the menu above the window
// if some window is focused, place menu above window, else fall
// back to selected monitor.
@ -292,13 +293,13 @@ void monitor_active ( xcb_connection_t *xcb_connection, workarea *mon )
mon->b = r->border_width;
mon->l = r->border_width;
mon->r = r->border_width;
free(r);
free(t);
free ( r );
free ( t );
return;
}
}
monitor_dimensions ( xcb_connection, xcb_screen, r->x, r->y, mon );
free(r);
free ( r );
return;
}
}
@ -312,15 +313,14 @@ void monitor_active ( xcb_connection_t *xcb_connection, workarea *mon )
int take_keyboard ( xcb_connection_t *xcb_connection, xcb_window_t w )
{
for ( int i = 0; i < 500; i++ ) {
xcb_grab_keyboard_cookie_t cc = xcb_grab_keyboard ( xcb_connection,
1, w, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC);
xcb_grab_keyboard_reply_t *r = xcb_grab_keyboard_reply ( xcb_connection, cc, NULL);
1, w, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC );
xcb_grab_keyboard_reply_t *r = xcb_grab_keyboard_reply ( xcb_connection, cc, NULL );
if ( r ) {
if ( r->status == XCB_GRAB_STATUS_SUCCESS) {
free(r);
if ( r->status == XCB_GRAB_STATUS_SUCCESS ) {
free ( r );
return 1;
}
free ( r );
@ -333,7 +333,7 @@ int take_keyboard ( xcb_connection_t *xcb_connection, xcb_window_t w )
void release_keyboard ( xcb_connection_t *xcb_connection )
{
xcb_ungrab_keyboard ( xcb_connection, XCB_CURRENT_TIME);
xcb_ungrab_keyboard ( xcb_connection, XCB_CURRENT_TIME );
}
static unsigned int x11_find_mod_mask ( xkb_stuff *xkb, ... )
@ -438,7 +438,7 @@ void x11_parse_key ( char *combo, unsigned int *mod, xkb_keysym_t *key )
i--;
}
xkb_keysym_t sym = xkb_keysym_from_name ( combo + i, XKB_KEYSYM_NO_FLAGS);
xkb_keysym_t sym = xkb_keysym_from_name ( combo + i, XKB_KEYSYM_NO_FLAGS );
if ( sym == XKB_KEY_NoSymbol || ( !modmask && ( strchr ( combo, '-' ) || strchr ( combo, '+' ) ) ) ) {
g_string_append_printf ( str, "Sorry, rofi cannot understand the key combination: <i>%s</i>\n", combo );
@ -463,8 +463,8 @@ void x11_set_window_opacity ( xcb_connection_t *xcb_connection, xcb_window_t box
// Scale 0-100 to 0 - UINT32_MAX.
unsigned int opacity_set = ( unsigned int ) ( ( opacity / 100.0 ) * UINT32_MAX );
xcb_change_property( xcb_connection, XCB_PROP_MODE_REPLACE, box,
netatoms[_NET_WM_WINDOW_OPACITY], XCB_ATOM_CARDINAL, 32, 1L, &opacity_set);
xcb_change_property ( xcb_connection, XCB_PROP_MODE_REPLACE, box,
netatoms[_NET_WM_WINDOW_OPACITY], XCB_ATOM_CARDINAL, 32, 1L, &opacity_set );
}
/**
@ -474,18 +474,17 @@ void x11_set_window_opacity ( xcb_connection_t *xcb_connection, xcb_window_t box
*/
static void x11_create_frequently_used_atoms ( xcb_connection_t *xcb_connection )
{
// X atom values
// X atom values
for ( int i = 0; i < NUM_NETATOMS; i++ ) {
xcb_intern_atom_cookie_t cc = xcb_intern_atom ( xcb_connection, 0, strlen(netatom_names[i]), netatom_names[i]);
xcb_intern_atom_reply_t *r = xcb_intern_atom_reply ( xcb_connection, cc, NULL);
xcb_intern_atom_cookie_t cc = xcb_intern_atom ( xcb_connection, 0, strlen ( netatom_names[i] ), netatom_names[i] );
xcb_intern_atom_reply_t *r = xcb_intern_atom_reply ( xcb_connection, cc, NULL );
if ( r ) {
netatoms[i] = r->atom;
free(r);
netatoms[i] = r->atom;
free ( r );
}
}
}
void x11_setup ( xcb_connection_t *xcb_connection, xkb_stuff *xkb )
{
// determine numlock mask so we can bind on keys with and without it

View File

@ -225,7 +225,7 @@ static void __config_parse_xresource_options ( XrmDatabase xDB )
}
void config_parse_xresource_options ( xcb_connection_t *xcb_connection, xcb_screen_t *xcb_screen )
{
char *name = window_get_text_prop ( xcb_connection, xcb_screen->root, XCB_ATOM_RESOURCE_MANAGER);
char *name = window_get_text_prop ( xcb_connection, xcb_screen->root, XCB_ATOM_RESOURCE_MANAGER );
if ( name ) {
// Map Xresource entries to rofi config options.
XrmDatabase xDB = XrmGetStringDatabase ( name );
@ -331,8 +331,8 @@ static void __config_parse_xresource_options_dynamic ( XrmDatabase xDB )
void config_parse_xresource_options_dynamic ( xcb_connection_t *xcb_connection, xcb_screen_t *xcb_screen )
{
char *name = window_get_text_prop ( xcb_connection, xcb_screen->root, XCB_ATOM_RESOURCE_MANAGER);
XrmDatabase xDB = XrmGetStringDatabase ( name );
char *name = window_get_text_prop ( xcb_connection, xcb_screen->root, XCB_ATOM_RESOURCE_MANAGER );
XrmDatabase xDB = XrmGetStringDatabase ( name );
__config_parse_xresource_options_dynamic ( xDB );
XrmDestroyDatabase ( xDB );
g_free ( name );

View File

@ -32,9 +32,9 @@ int show_error_message ( const char *msg, int markup )
rofi_view_error_dialog ( msg, markup );
return 0;
}
xcb_screen_t *xcb_screen;
xcb_screen_t *xcb_screen;
xcb_ewmh_connection_t xcb_ewmh;
int xcb_screen_nbr;
int xcb_screen_nbr;
#include <x11-helper.h>
int main ( int argc, char ** argv )

View File

@ -24,9 +24,8 @@ unsigned int normal_window_mode = 0;
void rofi_view_queue_redraw ()
{
}
Color color_get (const char *name)
Color color_get ( const char *name )
{
}
void rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
@ -46,9 +45,9 @@ int show_error_message ( const char *msg, int markup )
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
cairo_surface_t *surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);
cairo_t *draw = cairo_create(surf);
PangoContext *p = pango_cairo_create_context ( draw );
cairo_surface_t *surf = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, 100, 100 );
cairo_t *draw = cairo_create ( surf );
PangoContext *p = pango_cairo_create_context ( draw );
textbox_set_pango_context ( p );
textbox *box = textbox_create ( TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, 0, 0, -1, -1,
@ -129,5 +128,4 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
textbox_free ( box );
textbox_cleanup ( );
}