/** Update the list of supported protocols for a client. * \param c The client. * \param reply The xcb property reply. */ void property_update_wm_protocols(client_t *c, xcb_get_property_reply_t *reply) { xcb_icccm_get_wm_protocols_reply_t protocols; xcb_get_property_reply_t *reply_copy; if(reply) { reply_copy = p_dup(reply, 1); if(!xcb_icccm_get_wm_protocols_from_reply(reply_copy, &protocols)) { p_delete(&reply_copy); return; } } else { /* If this fails for any reason, we still got the old value */ if(!xcb_icccm_get_wm_protocols_reply(globalconf.connection, xcb_icccm_get_wm_protocols_unchecked(globalconf.connection, c->window, WM_PROTOCOLS), &protocols, NULL)) return; } xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols); memcpy(&c->protocols, &protocols, sizeof(protocols)); }
ByteArrayInputStream& ByteArrayInputStream::operator =(ByteArrayInputStream *ff) { //p_open=ff->s_open; p_close=ff->s_close; p_read=ff->s_read; p_reset=ff->s_reset; p_dup=ff->s_dup; p_skip=ff->s_skip; handle=ff->handle; if(p_dup)handle=p_dup(handle); delete ff; return *this; }
FileOutputStream& FileOutputStream::operator =(FileOutputStream *ff) { p_open=s_open; p_close=s_close; p_write=s_write; p_flush=s_flush; p_dup=s_dup; isappend=ff->isappend; if(isappend){ p_open=s_open2; p_dup=s_dup2; } handle=ff->handle; if(p_dup)handle=p_dup(handle); delete ff; return *this; }
/** XRandR event handler for RRNotify subtype XRROutputChangeNotifyEvent */ static void event_handle_randr_output_change_notify(xcb_randr_notify_event_t *ev) { if(ev->subCode == XCB_RANDR_NOTIFY_OUTPUT_CHANGE) { xcb_randr_output_t output = ev->u.oc.output; uint8_t connection = ev->u.oc.connection; char *output_name = NULL; const char *connection_str = NULL; xcb_randr_get_output_info_reply_t *info = NULL; lua_State *L = globalconf_get_lua_State(); info = xcb_randr_get_output_info_reply(globalconf.connection, xcb_randr_get_output_info_unchecked(globalconf.connection, output, XCB_CURRENT_TIME), NULL); if(!info) return; output_name = p_dup((char *)xcb_randr_get_output_info_name(info), xcb_randr_get_output_info_name_length(info)); switch(connection) { case XCB_RANDR_CONNECTION_CONNECTED: connection_str = "Connected"; break; case XCB_RANDR_CONNECTION_DISCONNECTED: connection_str = "Disconnected"; break; default: connection_str = "Unknown"; break; } lua_pushstring(L, output_name); lua_pushstring(L, connection_str); signal_object_emit(L, &global_signals, "screen::change", 2); p_delete(&output_name); p_delete(&info); /* The docs for RRSetOutputPrimary say we get this signal */ screen_update_primary(); } }