]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Stop using GTK3-deprecated gdk_get_display().
authorSimon Tatham <anakin@pobox.com>
Sat, 22 Aug 2015 13:07:02 +0000 (14:07 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 22 Aug 2015 13:07:02 +0000 (14:07 +0100)
The new way is gdk_display_get_name(gdk_display_get_default()), which
returns a const char * rather than a char *, so I've also had to
fiddle with the prototype and call sites of get_x_display().

(Also included gtkcompat.h into uxputty.c, since that wanted to call
gdk_get_display() but didn't previously include it.)

unix/gtkcompat.h
unix/gtkwin.c
unix/unix.h
unix/uxpty.c
unix/uxputty.c

index ec464d7215f4a62b4b7bc3cb5d48cb6f1f3f7a81..6a8674c7fda3205c73fa48b3cf6f940ae3cbe23b 100644 (file)
     gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing)
 #define gtk_vscrollbar_new(adjust) \
     gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, adjust)
+
+#define gdk_get_display() gdk_display_get_name(gdk_display_get_default())
+
 #endif
index 5c45a0a735603700be7be64be28d147118d377fd..0e04352e81757307e2b2b757a52e9c65900a2d9a 100644 (file)
@@ -2998,7 +2998,7 @@ void cmdline_error(const char *p, ...)
     exit(1);
 }
 
-char *get_x_display(void *frontend)
+const char *get_x_display(void *frontend)
 {
     return gdk_get_display();
 }
index d7bed49aed3644765de10554141d775702af29f9..6359a2cd0211a45068dbfe61c383723d431423e7 100644 (file)
@@ -74,7 +74,7 @@ unsigned long getticks(void);        /* based on gettimeofday(2) */
 #define FLAG_STDERR_TTY 0x1000
 
 /* Things pty.c needs from pterm.c */
-char *get_x_display(void *frontend);
+const char *get_x_display(void *frontend);
 int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
 long get_windowid(void *frontend);
 
index 84f36ef87bef2c5062829933dd5d48c77c0b11f5..d4244c5889b06100c50ae0b78de200b303f646e7 100644 (file)
@@ -759,7 +759,7 @@ static const char *pty_init(void *frontend, void **backend_handle, Conf *conf,
             close(pty_utmp_helper_pipe);   /* just let the child process die */
             pty_utmp_helper_pipe = -1;
         } else {
-            char *location = get_x_display(pty->frontend);
+            const char *location = get_x_display(pty->frontend);
             int len = strlen(location)+1, pos = 0;   /* +1 to include NUL */
             while (pos < len) {
                 int ret = write(pty_utmp_helper_pipe, location+pos, len - pos);
index f0b4bfbda75b1666946c2b043cf896208c465f04..d0ba55f68177a7bc68da8084d21e96a8104f692a 100644 (file)
@@ -7,11 +7,14 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <unistd.h>
+#include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
 #include "putty.h"
 #include "storage.h"
 
+#include "gtkcompat.h"
+
 /*
  * Stubs to avoid uxpty.c needing to be linked in.
  */