To: vim-dev@vim.org Subject: patch 5.5.027 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.5.027 Problem: Unix: os_unix.c doesn't compile when XTERM_CLIP is used but WANT_TITLE isn't. (Barnum) Solution: Move a few functions that are used by the X11 title and clipboard and put another "#if" around it. Files: src/os_unix.c *** ../vim-5.5.26/src/os_unix.c Sat Sep 25 20:35:49 1999 --- src/os_unix.c Sun Oct 17 17:06:23 1999 *************** *** 110,116 **** # ifdef WANT_TITLE static int get_x11_windis __ARGS((void)); - static int test_x11_window __ARGS((Display *dpy)); static void set_x11_title __ARGS((char_u *)); static void set_x11_icon __ARGS((char_u *)); # endif --- 110,115 ---- *************** *** 759,769 **** return FALSE; } ! #ifdef WANT_TITLE ! ! #if defined(HAVE_X11) && defined(WANT_X11) ! ! static int get_x11_thing __ARGS((int get_title, int test_only)); /* * X Error handler, otherwise X just exits! (very rude) -- webb --- 758,771 ---- return FALSE; } ! #if defined(HAVE_X11) && defined(WANT_X11) \ ! && (defined(WANT_TITLE) || defined(XTERM_CLIP)) ! /* ! * A few functions shared by X11 title and clipboard code. ! */ ! static int x_error_handler __ARGS((Display *dpy, XErrorEvent *error_event)); ! static int x_error_check __ARGS((Display *dpy, XErrorEvent *error_event)); ! static int test_x11_window __ARGS((Display *dpy)); /* * X Error handler, otherwise X just exits! (very rude) -- webb *************** *** 798,803 **** --- 800,836 ---- } /* + * Test if "dpy" and x11_window are valid by getting the window title. + * I don't actually want it yet, so there may be a simpler call to use, but + * this will cause the error handler x_error_check() to be called if anything + * is wrong, such as the window pointer being invalid (as can happen when the + * user changes his DISPLAY, but not his WINDOWID) -- webb + */ + static int + test_x11_window(dpy) + Display *dpy; + { + int (*old_handler)(); + XTextProperty text_prop; + + old_handler = XSetErrorHandler(x_error_check); + got_x_error = FALSE; + if (XGetWMName(dpy, x11_window, &text_prop)) + XFree((void *)text_prop.value); + XSync(dpy, False); + (void)XSetErrorHandler(old_handler); + + return (got_x_error ? FAIL : OK); + } + #endif + + #ifdef WANT_TITLE + + #if defined(HAVE_X11) && defined(WANT_X11) + + static int get_x11_thing __ARGS((int get_title, int test_only)); + + /* * try to get x11 window and display * * return FAIL for failure, OK otherwise *************** *** 926,955 **** if (x11_window == 0 || x11_display == NULL) return (result = FAIL); return (result = OK); - } - - /* - * Test if "dpy" and x11_window are valid by getting the window title. - * I don't actually want it yet, so there may be a simpler call to use, but - * this will cause the error handler x_error_check() to be called if anything - * is wrong, such as the window pointer being invalid (as can happen when the - * user changes his DISPLAY, but not his WINDOWID) -- webb - */ - static int - test_x11_window(dpy) - Display *dpy; - { - int (*old_handler)(); - XTextProperty text_prop; - - old_handler = XSetErrorHandler(x_error_check); - got_x_error = FALSE; - if (XGetWMName(dpy, x11_window, &text_prop)) - XFree((void *)text_prop.value); - XSync(dpy, False); - (void)XSetErrorHandler(old_handler); - - return (got_x_error ? FAIL : OK); } /* --- 959,964 ---- *** ../vim-5.5.26/src/version.c Sun Oct 17 16:44:57 1999 --- src/version.c Sun Oct 17 17:14:34 1999 *************** *** 420,420 **** --- 420,421 ---- { /* Add new patch number below this line */ + 27, -- ARTHUR: But if he was dying, he wouldn't bother to carve "Aaaaarrrrrrggghhh". He'd just say it. BROTHER MAYNARD: It's down there carved in stone. GALAHAD: Perhaps he was dictating. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /