diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-03-29 11:38:52 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2011-03-29 11:38:52 +0200 |
commit | 64e522444ee81d5507b89479ec03fa3b03ed35f2 (patch) | |
tree | ddedff034a84d50abcdc43def4ed3fc88dcc7fbe | |
parent | e7ba55789ccf61d22c76662b08648160a742aa88 (diff) |
vdagent-x11: add vdagent_x11_next_selection_request helper
-rw-r--r-- | vdagent-x11.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/vdagent-x11.c b/vdagent-x11.c index fd4d1ec..1660ef1 100644 --- a/vdagent-x11.c +++ b/vdagent-x11.c @@ -200,6 +200,14 @@ int vdagent_x11_get_fd(struct vdagent_x11 *x11) return x11->fd; } +static void vdagent_x11_next_selection_request(struct vdagent_x11 *x11) +{ + struct vdagent_x11_selection_request *selection_request; + selection_request = x11->selection_request; + x11->selection_request = selection_request->next; + free(selection_request); +} + static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11, int new_owner) { @@ -209,11 +217,8 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11, "selection requests pending on clipboard ownership change, " "clearing"); while (x11->selection_request) { - struct vdagent_x11_selection_request *selection_request; vdagent_x11_send_selection_notify(x11, None, 0); - selection_request = x11->selection_request; - x11->selection_request = selection_request->next; - free(selection_request); + vdagent_x11_next_selection_request(x11); } } if (x11->clipboard_request_target != None) { @@ -703,7 +708,6 @@ static void vdagent_x11_send_selection_notify(struct vdagent_x11 *x11, Atom prop, int process_next_req) { XEvent res, *event = &x11->selection_request->event; - struct vdagent_x11_selection_request *selection_request; res.xselection.property = prop; res.xselection.type = SelectionNotify; @@ -716,9 +720,7 @@ static void vdagent_x11_send_selection_notify(struct vdagent_x11 *x11, XFlush(x11->display); if (process_next_req) { - selection_request = x11->selection_request; - x11->selection_request = selection_request->next; - free(selection_request); + vdagent_x11_next_selection_request(x11); vdagent_x11_handle_selection_request(x11); } } |