Commit 8a836c07 authored by Paolo Molaro's avatar Paolo Molaro

Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>


Sat,  6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>

	* gdk/nanox/*: nano-X port work in progress.
	* gdk/simple.c: simple test for Gdk.
	* README.nanox: notes about the port: read this first!
	* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
	with nano-X.
parent ea71f02a
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Sat, 6 May 2000 13:31:34 +0200 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/*: nano-X port work in progress.
* gdk/simple.c: simple test for Gdk.
* README.nanox: notes about the port: read this first!
* gtk/gtk{dnd,plug,selection,window}.c: minimal changes to make gtk compile
with nano-X.
Fri May 5 11:18:47 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c (gdk_window_clear): Move
......
Gtk port to nano-X
STATUS
Once upon a time I got a few apps working, then started merging
the new features added by Owen (32 bit sizes for windows and buffering).
Since then I haven't found the time to work on it:-/
TODO
Finish internal window manager abstraction or add proper support in nano-X.
Fix event polling.
Implement GdkImage, GdkRgb stuff.
Put generic region code in generic gdk and/or use the region code from nano-X.
Fix ugly automake stuff for make dist.
TODO in nano-X
We need to be able to clip and change the background of windows at runtime
for apps to not look so ugly!
Fonts: wait for better nano-X font implementation.
Properties on windows.
If you want to work on this port or get additional informnation, get in
touch with me.
To get the beast to compile you also need to apply the patch below
(any auto* wizard here?): the issue of having two gtk libraries in the
system needs to be addressed too, maybe use libgtk-x11-1.4.so and
libgtk-nanox-1.4.so ...
Paolo Molaro
lupus@linuxcare.com
Index: acconfig.h
===================================================================
RCS file: /cvs/gnome/gtk+/acconfig.h,v
retrieving revision 1.16
diff -u -r1.16 acconfig.h
--- acconfig.h 1999/03/20 00:52:29 1.16
+++ acconfig.h 2000/05/06 11:52:38
@@ -49,6 +49,8 @@
/* Most machines will be happy with int or void. IRIX requires '...' */
#undef SIGNAL_ARG_TYPE
+#undef USE_NANOX
+
/* #undef PACKAGE */
/* #undef VERSION */
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gtk+/configure.in,v
retrieving revision 1.142
diff -u -r1.142 configure.in
--- configure.in 2000/05/04 00:29:46 1.142
+++ configure.in 2000/05/06 11:52:38
@@ -99,6 +99,8 @@
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
+AC_ARG_ENABLE(nanox, [ --enable-nanox use nano-X instead of X11 [default=no]],
+ , enable_nanox="no")
if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
@@ -322,6 +324,8 @@
saved_cflags="$CFLAGS"
saved_ldflags="$LDFLAGS"
+if text "x$enable_nanox" = "xno"; then
+
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
@@ -465,6 +469,13 @@
GTK_LOCALE_FLAGS="-DX_LOCALE"
fi
+else
+AC_CHECK_LIB(nano-X, GrOpen)
+LIBS="-lnano-X $LIBS"
+ AC_DEFINE(USE_NANOX)
+AM_CONDITIONAL(USE_NANOX, test x$enable_nanox = xyes)
+fi # if enable_nanox
+
# Checks for header files.
AC_HEADER_STDC
@@ -602,8 +613,13 @@
esac
],[
# Currently we always use X11 on those systems where we run configure...
+if test x$enable_nanox = xno; then
gdk_windowing='
#define GDK_WINDOWING_X11'
+else
+gdk_windowing='
+#define GDK_WINDOWING_NANOX'
+fi
if test x$gdk_wchar_h = xyes; then
gdk_wc='
#define GDK_HAVE_WCHAR_H 1'
@@ -629,6 +645,7 @@
docs/Makefile
gdk/Makefile
gdk/x11/Makefile
+gdk/nanox/Makefile
gdk/win32/Makefile
gtk/Makefile
gtk/gtkfeatures.h
Index: gdk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/Makefile.am,v
retrieving revision 1.41
diff -u -r1.41 Makefile.am
--- gdk/Makefile.am 2000/04/05 04:11:10 1.41
+++ gdk/Makefile.am 2000/05/06 11:52:38
@@ -1,6 +1,10 @@
## Makefile.am for gtk+/gdk
+if USE_NANOX
+SUBDIRS=win32 nanox
+else
SUBDIRS=x11 win32
+endif
EXTRA_DIST = \
gdkconfig.h.win32 \
@@ -36,8 +40,13 @@
-lm \
@STRIP_END@
+if USE_NANOX
libgdk_la_LIBADD = \
+ nanox/libgdk-nanox.la
+else
+libgdk_la_LIBADD = \
x11/libgdk-x11.la
+endif
#
# setup source file variables
@@ -138,3 +147,8 @@
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
echo $$p; \
done
+
+noinst_PROGRAMS = simple
+simple_DEPENDENCIES = libgdk.la simple.c
+simple_LDADD = libgdk.la
+
## Process this file with automake to produce Makefile.in
INCLUDES = @STRIP_BEGIN@ \
-DG_LOG_DOMAIN=\"Gdk\" \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
@GTK_DEBUG_FLAGS@ \
@GTK_XIM_FLAGS@ \
@GTK_LOCALE_FLAGS@ \
@GLIB_CFLAGS@ \
@x_cflags@ \
@STRIP_END@
LDADDS = @STRIP_BEGIN@ \
@x_ldflags@ \
@x_libs@ \
@GLIB_LIBS@ \
-lm \
@STRIP_END@
noinst_LTLIBRARIES = libgdk-nanox.la
xinput_sources = \
gdkinput-none.c
libgdk_nanox_la_SOURCES = \
gdkcc-nanox.c \
gdkcolor-nanox.c \
gdkcursor-nanox.c \
gdkdnd-nanox.c \
gdkdrawable-nanox.c \
gdkevents-nanox.c \
gdkfont-nanox.c \
gdkgc-nanox.c \
gdkglobals-nanox.c \
gdkim-nanox.c \
gdkimage-nanox.c \
gdkinput.c \
gdkmain-nanox.c \
gdkpixmap-nanox.c \
gdkpolyreg-generic.c \
gdkproperty-nanox.c \
gdkregion-generic.c \
gdkselection-nanox.c \
gdkvisual-nanox.c \
gdkwindow-nanox.c \
gdknanox.h \
gdkprivate-nanox.h \
gdkinput-none.c
#include "gdk.h"
#include "gdkprivate-nanox.h"
GdkColorContext *
gdk_color_context_new (GdkVisual *visual,
GdkColormap *colormap)
{
g_message("unimplemented %s", __FUNCTION__);
return NULL;
}
GdkColorContext *
gdk_color_context_new_mono (GdkVisual *visual,
GdkColormap *colormap)
{
g_message("unimplemented %s", __FUNCTION__);
return NULL;
}
void
gdk_color_context_free (GdkColorContext *cc)
{
g_message("unimplemented %s", __FUNCTION__);
}
gulong
gdk_color_context_get_pixel (GdkColorContext *cc,
gushort red,
gushort green,
gushort blue,
gint *failed)
{
return RGB2PIXEL(red, green, blue);
}
void
gdk_color_context_get_pixels (GdkColorContext *cc,
gushort *reds,
gushort *greens,
gushort *blues,
gint ncolors,
gulong *colors,
gint *nallocated)
{
g_message("unimplemented %s", __FUNCTION__);
}
void
gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
gushort *reds,
gushort *greens,
gushort *blues,
gint ncolors,
gint *used,
gulong *colors,
gint *nallocated)
{
g_message("unimplemented %s", __FUNCTION__);
}
gint
gdk_color_context_query_color (GdkColorContext *cc,
GdkColor *color)
{
return gdk_color_context_query_colors (cc, color, 1);
}
gint
gdk_color_context_query_colors (GdkColorContext *cc,
GdkColor *colors,
gint num_colors)
{
g_message("unimplemented %s", __FUNCTION__);
return 0;
}
gint
gdk_color_context_add_palette (GdkColorContext *cc,
GdkColor *palette,
gint num_palette)
{
g_message("unimplemented %s", __FUNCTION__);
return 0;
}
void
gdk_color_context_init_dither (GdkColorContext *cc)
{
g_message("unimplemented %s", __FUNCTION__);
}
void
gdk_color_context_free_dither (GdkColorContext *cc)
{
g_message("unimplemented %s", __FUNCTION__);
}
gulong
gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
gushort *red,
gushort *green,
gushort *blue,
gint *failed)
{
g_message("unimplemented %s", __FUNCTION__);
return 0;
}
guchar
gdk_color_context_get_index_from_palette (GdkColorContext *cc,
gint *red,
gint *green,
gint *blue,
gint *failed)
{
g_message("unimplemented %s", __FUNCTION__);
return 0;
}
#include "gdk.h"
#include "gdkprivate-nanox.h"
#include <stdlib.h>
#include <string.h>
GdkColormap*
gdk_colormap_new (GdkVisual *visual,
gboolean private_cmap)
{
GdkColormap *colormap;
GdkColormapPrivateX *private;
int size;
int i;
g_return_val_if_fail (visual != NULL, NULL);
private = g_new (GdkColormapPrivateX, 1);
colormap = (GdkColormap*) private;
private->base.visual = visual;
private->base.ref_count = 1;
colormap->size = visual->colormap_size;
colormap->colors = NULL;
return colormap;
}
void
_gdk_colormap_real_destroy (GdkColormap *colormap)
{
}
void
gdk_colormap_sync (GdkColormap *colormap,
gboolean force)
{
g_message("unimplemented %s", __FUNCTION__);
}
GdkColormap*
gdk_colormap_get_system (void)
{
return gdk_colormap_new(gdk_visual_get_system(), 0);
}
gint
gdk_colormap_get_system_size (void)
{
GR_PALETTE palette;
GrGetSystemPalette(&palette);
return palette.count;
}
void
gdk_colormap_change (GdkColormap *colormap,
gint ncolors)
{
g_message("unimplemented %s", __FUNCTION__);
}
gboolean
gdk_colors_alloc (GdkColormap *colormap,
gboolean contiguous,
gulong *planes,
gint nplanes,
gulong *pixels,
gint npixels)
{
g_message("unimplemented %s", __FUNCTION__);
return 1;
}
static struct cspec {
char *name;
int red, green, blue;
} cnames [] = {
{"white", 0xffff, 0xffff, 0xffff},
{"black", 0, 0, 0},
{"red", 0xffff, 0, 0},
{"green", 0, 0xffff, 0},
{"blue", 0, 0, 0xffff},
{NULL}
};
gboolean
gdk_color_parse (const gchar *spec,
GdkColor *color)
{
int size, csize, i, j, shift;
double dval;
gchar *end;
int scale[] = {0, 4096, 256, 16, 1};
int add[] = {0, 4095, 255, 15, 1};
g_return_val_if_fail(spec != NULL, 0);
g_return_val_if_fail(color != NULL, 0);
g_message("color parsing %s", spec);
if (*spec == '#') {
spec++;
size = strlen(spec);
csize = size/3;
shift = 16-csize*4;
if (size > 12 || size % 3)
return 0;
j = spec[csize];
spec[csize] = 0;
color->red = strtol(spec, &end, 16) << shift;
if (end == spec || *end != '\0')
return 0;
spec[csize] = j;
spec += csize;
/* green */
j = spec[csize];
spec[csize] = 0;
color->green = strtol(spec, &end, 16) << shift;
if (end == spec || *end != '\0')
return 0;
spec[csize] = j;
spec += csize;
/* blue */
color->blue = strtol(spec, &end, 16) << shift;
if (end == spec || *end != '\0')
return 0;
return 1;
} else if (!strncmp(spec, "rgb:", 4)) {
spec += 4;
color->red = strtol(spec, &end, 16);
if (end == spec || *end != '/')
return 0;
csize = end-spec;
color->red *= scale[csize];
color->red += add[csize];
spec += csize + 1;
/* green */
color->green = strtol(spec, &end, 16);
if (end == spec || *end != '/')
return 0;
csize = end-spec;
color->green *= scale[csize];
color->green += add[csize];
spec += csize + 1;
/* blue */
color->blue = strtol(spec, &end, 16);
if (end == spec || *end != '\0')
return 0;
csize = end-spec;
color->blue *= scale[csize];
color->blue += add[csize];
return 1;
} else if (!strncmp(spec, "rgbi:", 5)) {
spec += 5;
dval = strtod(spec, &end);
if (end == spec || *end != '/' || dval > 1.0 || dval < 0)
return 0;
color->red = dval*0xffff;
spec += end-spec + 1;
/* green */
dval = strtod(spec, &end);
if (end == spec || *end != '/' || dval > 1.0 || dval < 0)
return 0;
color->green = dval*0xffff;
spec += end-spec + 1;
/* blue */
dval = strtod(spec, &end);
if (end == spec || *end != '0' || dval > 1.0 || dval < 0)
return 0;
color->blue = dval*0xffff;
return 1;
} else {
/* use a cdb database, instead, later */
for (i=0; cnames[i].name; ++i) {
if (strcmp(cnames[i].name, spec))
continue;
color->red = cnames[i].red;
color->green = cnames[i].green;
color->blue = cnames[i].blue;
return 1;
}
if (spec[0] == 'g' && spec[1] == 'r' && (spec[2] == 'a' || spec[2] == 'e') && spec[3] == 'y') {
dval = strtol(spec+4, NULL, 10)/100;
color->red = color->green = color->blue = 255 * dval;
return 1;
}
}
return 0;
}
void
gdk_colors_free (GdkColormap *colormap,
gulong *in_pixels,
gint in_npixels,
gulong planes)
{
g_message("unimplemented %s", __FUNCTION__);
}
void
gdk_colormap_free_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors)
{
g_message("unimplemented %s", __FUNCTION__);
}
gint
gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
int i;
for (i=0; i < ncolors;++i)
colors[i].pixel = RGB2PIXEL(colors[i].red>>8, colors[i].green>>8, colors[i].blue>>8);
success = 1;
return 1;
}
gboolean
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
{
g_message("unimplemented %s", __FUNCTION__);
return 1;
}
#include "gdk.h"
#include "gdkprivate-nanox.h"
GdkCursor*
gdk_cursor_new (GdkCursorType cursor_type) {
g_message("unimplemented %s", __FUNCTION__);
return NULL;
}
GdkCursor*
gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y)
{
g_message("unimplemented %s", __FUNCTION__);
return NULL;
}
void
_gdk_cursor_destroy (GdkCursor *cursor)
{
}
#include "gdk.h"
#include "gdkprivate-nanox.h"
GdkDragContext *
gdk_drag_context_new (void)
{
g_message("unimplemented %s", __FUNCTION__);
return NULL;
}
void
gdk_drag_context_ref (GdkDragContext *context)
{
}
void
gdk_drag_context_unref (GdkDragConte