diff options
author | George Peter Staplin <gps@Georges-Workstation.local> | 2008-10-27 20:44:02 -0600 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-10-28 22:01:29 -0700 |
commit | 313d87341aff2396645d2c315086d487c0073d27 (patch) | |
tree | 07589bb71a16c999387805ac43db480b91100d20 /hw/xquartz/pbproxy | |
parent | 9007d3beea2e2d8b271f696d433cb30e32cda401 (diff) |
XQuartz: pbproxy: Work around bugs in some apps that aren't ICCCM compliant.
Eterm ends up setting the type of the property to TARGETS, instead of ATOM.
That's why it wasn't working.
(cherry picked from commit 9be5998ede7427f14dd9597e117b3d6b427ba4e5)
Diffstat (limited to 'hw/xquartz/pbproxy')
-rw-r--r-- | hw/xquartz/pbproxy/x-selection.m | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m index 5290c8fe3..59b38bd61 100644 --- a/hw/xquartz/pbproxy/x-selection.m +++ b/hw/xquartz/pbproxy/x-selection.m @@ -236,12 +236,13 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato for (i = 0; i < pdata->length; i += sizeof (a)) { + a = 0; memcpy (&a, pdata->data + i, sizeof (a)); - + if (a == atoms->image_png) { png = True; - } + } else if (a == atoms->image_jpeg) { jpeg = True; @@ -257,8 +258,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato else { char *type = XGetAtomName(x_dpy, a); - DB("Unhandled X11 mime type: %s", type); - XFree(type); + if (type) + { + DB("Unhandled X11 mime type: %s", type); + XFree(type); + } } } @@ -482,8 +486,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato */ - (void) clear_event:(XSelectionClearEvent *)e { - TRACE (); + + TRACE (); + DB ("e->selection %s\n", XGetAtomName (x_dpy, e->selection)); if(e->selection == atoms->clipboard) { @@ -1087,9 +1093,16 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato TRACE (); - if (None != e->atom) - DB ("e->atom %s\n", XGetAtomName (x_dpy, e->atom)); + if (None != e->atom) + { + char *name = XGetAtomName (x_dpy, e->atom); + if (name) + { + DB ("e->atom %s\n", name); + XFree(name); + } + } if (None != pending.requestor && PropertyNewValue == e->state) { @@ -1315,7 +1328,12 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato printf ("type %s\n", XGetAtomName (x_dpy, type)); #endif - if (request_atom == atoms->targets && type == atoms->atom) + /* + * Some apps it seems set the type to TARGETS instead of ATOM, such as Eterm. + * These aren't ICCCM compliant apps, but we need these to work... + */ + if (request_atom == atoms->targets + && (type == atoms->atom || type == atoms->targets)) { [self handle_targets:selection propdata:pdata]; } @@ -1345,8 +1363,17 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato - (void) copy_completed:(Atom)selection { TRACE (); - - DB ("copy_completed: %s\n", XGetAtomName (x_dpy, selection)); + char *name; + + (void)name; /* Avoid warning with non-debug compiles. */ +#ifdef DEBUG + name = XGetAtomName (x_dpy, selection); + if (name) + { + DB ("copy_completed: %s\n", name); + XFree (name); + } +#endif if (selection == atoms->primary && pending_copy > 0) { |