little bug in option.c

2003-02-09 Thread Mike Smithson
I was playing with option.c and ran across this tiny
bug. If you change PANEL_OPTIONS the dialog doesn't
display properly anymore. Atached is the diff to make
it work and be consistent with the way OTHER_OPTIONS
is handled also.



--- mc-cvs-4.6.0-030207/src/option.cSat Dec  7 20:16:30 2002
+++ mc-draft-4.6.0-030207/src/option.c  Sun Feb  9 11:16:02 2003
@@ -229,7 +230,7 @@
 /* Add checkboxes for panel options */
 for (i = 0; i  PANEL_OPTIONS; i++) {
check_options[i + OTHER_OPTIONS].widget =
-   check_new (PY + (6 - i), PX + 2, XTRACT (i + OTHER_OPTIONS));
+   check_new (PY + (PANEL_OPTIONS - i), PX + 2, XTRACT (i + OTHER_OPTIONS));
add_widget (conf_dlg, check_options[i + OTHER_OPTIONS].widget);
 }
 }





Re: [PATCH] key.c: Dynamically load XOpenDisplay, XQueryPointer andXCloseDisplay

2003-02-09 Thread Pavel Tsekov
Hello,

Ok, here comes the new patch. It is using the gmodule library as
Pavel Rosking has suggested. It also includes some changes to the 
configure stuff. Please, review and tell me what needs to be fixed.

Here is a list of changes:

* aclocal.m4 (AC_G_MODULE_SUPPORTED): New macro. Tests if gmodule 
functionality of glib can be used. Sets the variable 
'av_g_module_supported' and the macros 'HAVE_WORKING_GMODULE'.
* config.h.in (HAVE_WORKING_GMODULE): New macro.
* configure.in: Detect if gmodule library is present and can be used. 
Update GLIB_FLAGS and GLIB_LIBS accordingly.
Add necessary X libraries to MCLIBS only if 'av_g_module_supported' is
set to 'no'.
* src/key.c: Include gmodule.h if 'HAVE_WORKING_GMODULE' is defined.
(MODULE_DEFAULT_PREFIX): New macro.
(MODULE_DEFUALT_SUFFIX): Ditto.
(MODX11_DEFAULT_NAME): Ditto. Use 'MODULE_DEFAULT_PREFIX' and 
'MODULE_DEFAULT_SUFFIX' macros.
(XOPENDISPLAY): Define new pointer to function type.
(XCLOSEDISPLAY): Ditto.
(XQUERYPOINTER): Ditto.
(x11_module): New static variable.
(func_XOpenDisplay): Ditto.
(func_XCloseDisplay): Ditto.
(func_XQueryPointer): Ditto.
(init_key): Dynamically load XOpenDisplay, XCloseDisplay and XQueryPointer
functions if 'HAVE_WORKING_GMODULE' is defined.
Use 'func_XOpenDisplay'.
(get_modifier): Use 'func_XQueryPointer'.
(done_key): Use 'func_XCloseDisplay'.
Unload the dynamcally loaded library X11 if 'HAVE_WORKING_GMODULE' is 
defined.

diff -rup mc-4.6.0/aclocal.m4 mc-4.6.0-mod/aclocal.m4
--- mc-4.6.0/aclocal.m4 2003-02-05 19:08:57.0 +0100
+++ mc-4.6.0-mod/aclocal.m4 2003-02-09 19:21:40.0 +0100
@@ -3881,3 +3881,35 @@ AC_DEFUN([AM_LC_MESSAGES],
   fi
 ])
 
+dnl
+dnl Check whether the g_module_* family of functions works
+dnl on this system.
+dnl
+AC_DEFUN([AC_G_MODULE_SUPPORTED], [
+av_g_module_supported=no
+AC_MSG_CHECKING([if g_module_* family of functions works])
+ac_save_CFLAGS=$CFLAGS
+ac_save_LIBS=$LIBS
+CFLAGS=$CFLAGS $GLIB_CFLAGS
+LIBS=$GLIB_LIBS $LIBS
+AC_TRY_RUN([
+#include gmodule.h
+
+int main ()
+{
+int ret = g_module_supported () ? 0 : 1;
+return ret;
+}
+],[
+AC_DEFINE(HAVE_WORKING_GMODULE, 1,
+ [Define if we have working gmodule library])
+av_g_module_supported=yes
+],[
+av_g_module_supported=no
+],[
+av_g_module_supported=no
+])
+CFLAGS=$ac_save_CFLAGS
+LIBS=$ac_save_LIBS
+AC_MSG_RESULT([$av_g_module_supported])
+])
diff -rup mc-4.6.0/config.h.in mc-4.6.0-mod/config.h.in
--- mc-4.6.0/config.h.in2003-02-05 19:09:02.0 +0100
+++ mc-4.6.0-mod/config.h.in2003-02-09 18:28:18.0 +0100
@@ -668,4 +668,7 @@
 /* Define to `int' if sys/types.h does not define. */
 #undef umode_t
 
+/* Define if we can use gmodule functionality */
+#undef HAVE_WORKING_GMODULE
+
 #include extraconf.h
diff -rup mc-4.6.0/configure.in mc-4.6.0-mod/configure.in
--- mc-4.6.0/configure.in   2003-02-05 19:03:56.0 +0100
+++ mc-4.6.0-mod/configure.in   2003-02-09 19:25:45.0 +0100
@@ -38,8 +38,25 @@ if test x$glib_found = xno ; then
AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config (version 1.2.x only)])
AM_PATH_GLIB(1.2.6,,[AC_MSG_ERROR([Test for glib failed.
 GNU Midnight Commander requires glib 1.2.6 or above.])])
+   save_GLIB_CFLAGS=$GLIB_CFLAGS
+save_GLIB_LIBS=$GLIB_LIBS
+   AM_PATH_GLIB(1.2.6,,[gmodule_found=no],[gmodule])
+else
+save_GLIB_CFLAGS=$GLIB_CFLAGS
+save_GLIB_LIBS=$GLIB_LIBS
+PKG_CHECK_MODULES(GLIB, [gmodule-2.0], , [gmodule_found=no])
 fi
 
+if test x$gmodule_found = xno ; then
+GLIB_CFLAGS=$save_GLIB_CFLAGS
+GLIB_LIBS=$save_GLIB_LIBS
+else
+AC_G_MODULE_SUPPORTED
+if test x$av_g_module_supported = xno ; then
+   GLIB_CFLAGS=$save_GLIB_CFLAGS
+   GLIB_LIBS=$save_GLIB_LIBS
+fi
+fi
 
 AC_HEADER_MAJOR
 AC_C_CONST
@@ -214,7 +231,9 @@ if test x$no_x = xyes; then
 textmode_x11_support=no
 else
 CPPFLAGS=$CPPFLAGS $X_CFLAGS
-MCLIBS=$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS
+if test x$av_g_module_supported = xno ; then
+MCLIBS=$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS
+fi
 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
  [Define to enable getting events from X Window System])
 textmode_x11_support=yes
diff -rup mc-4.6.0/src/key.c mc-4.6.0-mod/src/key.c
--- mc-4.6.0/src/key.c  2003-01-27 23:37:56.0 +0100
+++ mc-4.6.0-mod/src/key.c  2003-02-09 19:17:50.0 +0100
@@ -41,6 +41,9 @@
 #include ../vfs/vfs.h
 
 #ifdef HAVE_TEXTMODE_X11_SUPPORT
+#ifdef HAVE_WORKING_GMODULE
+#include gmodule.h
+#endif /* HAVE_WORKING_GMODULE */
 #include X11/Xlib.h
 #endif
 
@@ -247,6 +250,30 @@ define_sequences (key_define_t *kd)
 }
 
 #ifdef HAVE_TEXTMODE_X11_SUPPORT
+#ifdef HAVE_WORKING_GMODULE
+#define MODULE_DEFAULT_PREFIX lib
+#if GLIB_CHECK_VERSION(2,0,0)
+#define MODULE_DEFAULT_SUFFIX . G_MODULE_SUFFIX
+#else /* glib  2.x.x */
+#ifndef 

Re: [PATCH] key.c: Dynamically load XOpenDisplay, XQueryPointer andXCloseDisplay

2003-02-09 Thread Pavel Tsekov
On Sun, 9 Feb 2003, Pavel Tsekov wrote:

 Hello,
 
 Ok, here comes the new patch. It is using the gmodule library as
 Pavel Rosking has suggested. It also includes some changes to the 
^^^
Sorry, for this mistake :(

Just wanted to tell that I've successfully tested it on RedHat Linux 8.0
and OpenBSD 3.2. Will also test it on Cygwin and Solaris9/SPARC later.


___
Mc-devel mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc-devel