public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: guile-gtk@sources.redhat.com
Subject: gdk-selection-property-get (was: Selection and DND completed)
Date: Fri, 08 Aug 2003 22:07:00 -0000	[thread overview]
Message-ID: <87d6ffdcsm.fsf@zip.com.au> (raw)
In-Reply-To: <m3znldciuq.fsf@lumo.pacujo.net>

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Marko Rauhamaa <marko@pacujo.net> writes:
>
> I set *prop_type to GDK_NONE and *prop_format to
> 8 (sic) in case of failure.

I think it'd be better as 0 to mean sort of no format at all,

        * gdk-support.c (gdk_selection_property_get_interp): Tweak to
        initialize prop_type and prop_format unconditionally, so as not to
        depend on gdk_selection_property_get at all for this.  Use 0 for
        prop_format not given by gdk_selection_property_get.


[-- Attachment #2: gdk-support.c.property-get.diff --]
[-- Type: text/plain, Size: 1142 bytes --]

--- gdk-support.c.~1.30.~	2003-08-05 10:32:59.000000000 +1000
+++ gdk-support.c	2003-08-08 15:51:13.000000000 +1000
@@ -30,18 +30,24 @@
 gdk_selection_property_get_interp (GdkWindow *requestor,
 				   GdkAtom *prop_type, int *prop_format)
 {
-  /* We need to initialize data to NULL because the GDK function returns
-   * a random value in data if requestor has been destroyed. */
-  guchar *data = NULL;
+  guchar *data;
   int length;
+
+  /* When the requestor window has been destroyed, it looks like
+     gdk_selection_property_get doesn't store anything in its return
+     locations.  Initialize here to be sure.  */
+  data = NULL;
+  *prop_type = GTK_NONE;
+  *prop_format = 0;
+
   length = gdk_selection_property_get (requestor, &data, prop_type,
 				       prop_format);
   /* Note: While we are returning a string, the data may actually be
    * anything and contain zeros. */
-  if (data) return scm_take_str (data, length);
-  *prop_type = GDK_NONE;
-  *prop_format = 8;
-  return SCM_BOOL_F;
+  if (data)
+    return scm_take_str (data, length);
+  else
+    return SCM_BOOL_F;
 }
 
 #define FUNCNAME "gdk-property-change"

      parent reply	other threads:[~2003-08-08 22:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-17  7:49 Selection and DND completed Marko Rauhamaa
2003-05-23 22:01 ` Kevin Ryde
2003-05-23 22:57   ` Marko Rauhamaa
2003-05-23 23:39     ` Kevin Ryde
2003-05-24  0:11       ` Marko Rauhamaa
2003-05-24  1:13         ` Kevin Ryde
2003-08-08 22:07         ` Kevin Ryde [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d6ffdcsm.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=guile-gtk@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).