summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-01 19:15:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-01 19:15:13 (GMT)
commitac700071228681cf1b8227258dc7d6e5a9982899 (patch)
tree1142f4902d53b04c460fe68eeb8778ce4a1554ac
parentc5a38f8dee64da2d1d20ee4f95fdc0a91d5617e9 (diff)
downloadtk-ac700071228681cf1b8227258dc7d6e5a9982899.zip
tk-ac700071228681cf1b8227258dc7d6e5a9982899.tar.gz
tk-ac700071228681cf1b8227258dc7d6e5a9982899.tar.bz2
CONSTify function XkbOpenDisplay(), and resolve conflict with definition in X11
-rw-r--r--generic/tkInt.decls4
-rw-r--r--generic/tkIntXlibDecls.h8
-rw-r--r--macosx/tkMacOSXXStubs.c2
-rw-r--r--unix/tkUnixEvent.c6
-rw-r--r--unix/tkUnixKey.c2
-rw-r--r--unix/tkUnixPort.h29
-rw-r--r--win/tkWinX.c2
7 files changed, 26 insertions, 27 deletions
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index d4355dc..dd493e9 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1552,7 +1552,7 @@ declare 157 win {
KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i)
}
declare 158 win {
- Display *XkbOpenDisplay(char *name, int *ev_rtrn, int *err_rtrn,
+ Display *XkbOpenDisplay(const char *name, int *ev_rtrn, int *err_rtrn,
int *major_rtrn, int *minor_rtrn, int *reason)
}
@@ -2049,7 +2049,7 @@ declare 157 macosx {
KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i)
}
declare 158 macosx {
- Display *XkbOpenDisplay(char *name, int *ev_rtrn, int *err_rtrn,
+ Display *XkbOpenDisplay(const char *name, int *ev_rtrn, int *err_rtrn,
int *major_rtrn, int *minor_rtrn, int *reason)
}
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 7f1560a..dc3764a 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -465,7 +465,7 @@ EXTERN void XFreeStringList(char **list);
EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g,
int i);
/* 158 */
-EXTERN Display * XkbOpenDisplay(char *name, int *ev_rtrn,
+EXTERN Display * XkbOpenDisplay(const char *name, int *ev_rtrn,
int *err_rtrn, int *major_rtrn,
int *minor_rtrn, int *reason);
#endif /* WIN */
@@ -885,7 +885,7 @@ EXTERN void XFreeStringList(char **list);
EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g,
int i);
/* 158 */
-EXTERN Display * XkbOpenDisplay(char *name, int *ev_rtrn,
+EXTERN Display * XkbOpenDisplay(const char *name, int *ev_rtrn,
int *err_rtrn, int *major_rtrn,
int *minor_rtrn, int *reason);
#endif /* MACOSX */
@@ -1053,7 +1053,7 @@ typedef struct TkIntXlibStubs {
XFontSet (*xCreateFontSet) (Display *display, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string); /* 155 */
void (*xFreeStringList) (char **list); /* 156 */
KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */
- Display * (*xkbOpenDisplay) (char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */
+ Display * (*xkbOpenDisplay) (const char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */
#endif /* WIN */
#ifdef MAC_OSX_TCL /* MACOSX */
int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
@@ -1214,7 +1214,7 @@ typedef struct TkIntXlibStubs {
XFontSet (*xCreateFontSet) (Display *display, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string); /* 155 */
void (*xFreeStringList) (char **list); /* 156 */
KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */
- Display * (*xkbOpenDisplay) (char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */
+ Display * (*xkbOpenDisplay) (const char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */
#endif /* MACOSX */
} TkIntXlibStubs;
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 11a0b35..4912583 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -225,7 +225,7 @@ TkpOpenDisplay(
Display *
XkbOpenDisplay(
- TCL_UNUSED(char *),
+ TCL_UNUSED(const char *),
int *ev_rtrn,
int *err_rtrn,
int *major_rtrn,
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 0303077..d31b5c1 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -13,7 +13,9 @@
#include "tkUnixInt.h"
#include <signal.h>
#undef register /* Keyword "register" is used in XKBlib.h, so don't try tricky things here */
+#define XkbOpenDisplay XkbOpenDisplay_ /* Move out of the way, conflicting definitions */
#include <X11/XKBlib.h>
+#undef XkbOpenDisplay
/*
* The following static indicates whether this module has been initialized in
@@ -154,10 +156,8 @@ TkpOpenDisplay(
** that the server supports it. The XkbOpenDisplay call
** will perform this check and return NULL if the extension
** is not supported.
- **
- ** Work around un-const-ified Xkb headers using (char *) cast.
*/
- display = XkbOpenDisplay((char *)displayNameStr, &event, &error, &major,
+ display = XkbOpenDisplay(displayNameStr, &event, &error, &major,
&minor, &reason);
if (display == NULL) {
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index c978294..1a5cb7d 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -13,7 +13,9 @@
#include "tkInt.h"
#undef register /* Keyword "register" is used in XKBlib.h, so don't try tricky things here */
+#define XkbOpenDisplay XkbOpenDisplay_ /* Move out of the way, conflicting definitions */
#include <X11/XKBlib.h>
+#undef XkbOpenDisplay
/*
* Prototypes for local functions defined in this file:
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index fae2f16..347c9d8 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -106,22 +106,19 @@
# define NBBY 8
#endif
-#ifdef __CYGWIN__
-# include "tkIntXlibDecls.h"
-# define UINT unsigned int
-# define HWND void *
-# define HDC void *
-# define HINSTANCE void *
-# define COLORREF void *
-# define HMENU void *
-# define TkWinDCState void
-# define HPALETTE void *
-# define WNDPROC void *
-# define WPARAM void *
-# define LPARAM void *
-# define LRESULT void *
-
-#endif /* !__CYGWIN__ */
+#include "tkIntXlibDecls.h"
+#define UINT unsigned int
+#define HWND void *
+#define HDC void *
+#define HINSTANCE void *
+#define COLORREF void *
+#define HMENU void *
+#define TkWinDCState void
+#define HPALETTE void *
+#define WNDPROC void *
+#define WPARAM void *
+#define LPARAM void *
+#define LRESULT void *
/*
* Supply macros for seek offsets, if they're not already provided by
diff --git a/win/tkWinX.c b/win/tkWinX.c
index e17dad1..0413a5f 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -559,7 +559,7 @@ TkpOpenDisplay(
Display *
XkbOpenDisplay(
- char *name,
+ const char *name,
int *ev_rtrn,
int *err_rtrn,
int *major_rtrn,