From f79a6d6d2e58e14eca695ccd873e009cff9ec612 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 27 Feb 2016 17:57:43 +0100 Subject: [PATCH] Convert view.c to xcb_ functions. secondary paste fails. --- source/view.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/source/view.c b/source/view.c index b942b4b0..d6c7e4c3 100644 --- a/source/view.c +++ b/source/view.c @@ -37,12 +37,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include #include #include @@ -1001,8 +995,10 @@ void rofi_view_update ( RofiViewState *state ) */ static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t *xse ) { - if ( xse->property == netatoms[UTF8_STRING] ) { - gchar *text = window_get_text_prop ( display, main_window, netatoms[UTF8_STRING] ); + if ( xse->property == XCB_ATOM_NONE ){ + fprintf ( stderr, "Failed to convert selection\n" ); + } else if ( xse->property == xcb_ewmh.UTF8_STRING ) { + gchar *text = window_get_text_prop ( display, main_window, xcb_ewmh.UTF8_STRING ); if ( text != NULL && text[0] != '\0' ) { unsigned int dl = strlen ( text ); // Strip new line @@ -1018,6 +1014,8 @@ static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t state->refilter = TRUE; } g_free ( text ); + } else { + fprintf ( stderr, "Failed\n" ); } } @@ -1345,11 +1343,14 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t if ( key != XKB_KEY_NoSymbol ) { // Handling of paste if ( abe_test_action ( PASTE_PRIMARY, modstate, key ) ) { - XConvertSelection ( display, XA_PRIMARY, netatoms[UTF8_STRING], netatoms[UTF8_STRING], main_window, CurrentTime ); + xcb_convert_selection ( xcb_connection, main_window, XCB_ATOM_PRIMARY, + xcb_ewmh.UTF8_STRING,xcb_ewmh.UTF8_STRING, XCB_CURRENT_TIME ); + xcb_flush ( xcb_connection ); } else if ( abe_test_action ( PASTE_SECONDARY, modstate, key ) ) { - XConvertSelection ( display, netatoms[CLIPBOARD], netatoms[UTF8_STRING], netatoms[UTF8_STRING], main_window, - CurrentTime ); + xcb_convert_selection ( xcb_connection, main_window, XCB_ATOM_SECONDARY, + xcb_ewmh.UTF8_STRING,xcb_ewmh.UTF8_STRING, XCB_CURRENT_TIME ); + xcb_flush ( xcb_connection ); } if ( abe_test_action ( SCREENSHOT, modstate, key ) ) { menu_capture_screenshot ( );