forked from AuroraMiddleware/gtk
Remove use of libunicode in favor of new GLib functions.
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c: Remove use of libunicode in favor of new GLib functions. * gtk/gtkcolorsel.c: Remove conditional includes for FB, win32, nano-x, framebuffer. The X11 include is just a hack until we get the necessary functions in gdkcolor.h, so there is no reason to add other includes of platforms. * gtk/gtkwindow.c (gtk_window_compute_default_size): Revert window bigger than the screen change. * gtk/testgtk.c: Revert some random changes from Elliot that had no particular point and were causing testgtkrc not to function correctly. * gdk/gdkregion-generic.h: Revert change from Elliot. Just because GdkSegment and GdkRegionBox have the same fields, it doesn't mean that 'typedef GdkSegment GdkRegionBox' results in clearer code. * gdk/x11/gdkinput-x11.c (gdk_input_common_select_events, gdk_input_translate_coordinates): Fix missed GdkObjectification
This commit is contained in:
parent
8a01e98fdf
commit
2a98bc6a31
26
ChangeLog
26
ChangeLog
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -1,3 +1,29 @@
|
||||
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c
|
||||
gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c:
|
||||
Remove use of libunicode in favor of new GLib functions.
|
||||
|
||||
* gtk/gtkcolorsel.c: Remove conditional includes for FB, win32,
|
||||
nano-x, framebuffer. The X11 include is just a hack until we get
|
||||
the necessary functions in gdkcolor.h, so there is no reason to
|
||||
add other includes of platforms.
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_compute_default_size): Revert
|
||||
window bigger than the screen change.
|
||||
|
||||
* gtk/testgtk.c: Revert some random changes from Elliot
|
||||
that had no particular point and were causing testgtkrc
|
||||
not to function correctly.
|
||||
|
||||
* gdk/gdkregion-generic.h: Revert change from Elliot. Just
|
||||
because GdkSegment and GdkRegionBox have the same fields,
|
||||
it doesn't mean that 'typedef GdkSegment GdkRegionBox'
|
||||
results in clearer code.
|
||||
|
||||
* gdk/x11/gdkinput-x11.c (gdk_input_common_select_events,
|
||||
gdk_input_translate_coordinates): Fix missed GdkObjectification
|
||||
|
||||
2000-06-18 Elliot Lee <sopwith@redhat.com>
|
||||
|
||||
* gdk/Makefile.am, gdk/*/Makefile.am: Fix conditionality to work the "right" way.
|
||||
|
@ -45,9 +45,12 @@ SOFTWARE.
|
||||
#ifndef __GDK_REGION_GENERIC_H__
|
||||
#define __GDK_REGION_GENERIC_H__
|
||||
|
||||
#include "gdktypes.h"
|
||||
typedef struct _GdkRegionBox GdkRegionBox;
|
||||
|
||||
typedef GdkSegment GdkRegionBox;
|
||||
struct _GdkRegionBox
|
||||
{
|
||||
int x1, x2, y1, y2;
|
||||
};
|
||||
|
||||
/*
|
||||
* clip region
|
||||
|
@ -395,7 +395,7 @@ gdk_input_common_select_events(GdkWindow *window,
|
||||
gdk_input_common_find_events(window, gdkdev, 0, classes, &num_classes);
|
||||
else
|
||||
gdk_input_common_find_events(window, gdkdev,
|
||||
((GdkWindowPrivate *)window)->extension_events,
|
||||
((GdkWindowObject *)window)->extension_events,
|
||||
classes, &num_classes);
|
||||
|
||||
XSelectExtensionEvent (gdk_display,
|
||||
@ -453,14 +453,14 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
gdouble *x, gdouble *y, gdouble *pressure,
|
||||
gdouble *xtilt, gdouble *ytilt)
|
||||
{
|
||||
GdkDrawablePrivate *drawable_priv;
|
||||
GdkWindowImplX11 *impl;
|
||||
|
||||
int x_axis, y_axis, pressure_axis, xtilt_axis, ytilt_axis;
|
||||
|
||||
double device_width, device_height;
|
||||
double x_offset, y_offset, x_scale, y_scale;
|
||||
|
||||
drawable_priv = (GdkDrawablePrivate *) input_window->window;
|
||||
impl = GDK_WINDOW_IMPL_X11 (((GdkWindowObject *) input_window->window)->impl);
|
||||
|
||||
x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
|
||||
y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
|
||||
@ -486,26 +486,26 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
|
||||
double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
|
||||
(device_width*gdkdev->axes[x_axis].resolution);
|
||||
|
||||
if (device_aspect * drawable_priv->width >= drawable_priv->height)
|
||||
if (device_aspect * impl->width >= impl->height)
|
||||
{
|
||||
/* device taller than window */
|
||||
x_scale = drawable_priv->width / device_width;
|
||||
x_scale = impl->width / device_width;
|
||||
y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
|
||||
/ gdkdev->axes[y_axis].resolution;
|
||||
|
||||
x_offset = 0;
|
||||
y_offset = -(device_height * y_scale -
|
||||
drawable_priv->height)/2;
|
||||
impl->height)/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* window taller than device */
|
||||
y_scale = drawable_priv->height / device_height;
|
||||
y_scale = impl->height / device_height;
|
||||
x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
|
||||
/ gdkdev->axes[x_axis].resolution;
|
||||
|
||||
y_offset = 0;
|
||||
x_offset = - (device_width * x_scale - drawable_priv->width)/2;
|
||||
x_offset = - (device_width * x_scale - impl->width)/2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,6 @@
|
||||
|
||||
#if defined (GDK_WINDOWING_X11)
|
||||
#include "x11/gdkx.h"
|
||||
#elif defined (GDK_WINDOWING_WIN32)
|
||||
#include "win32/gdkwin32.h"
|
||||
#elif defined (GDK_WINDOWING_NANOX)
|
||||
#include "nanox/gdkprivate-nanox.h"
|
||||
#elif defined (GDK_WINDOWING_FB)
|
||||
#include "linux-fb/gdkprivate-fb.h"
|
||||
#endif
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gtkcolorsel.h"
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "gtkstyle.h"
|
||||
|
||||
#include <pango/pango.h>
|
||||
#include <unicode.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#define MIN_ENTRY_WIDTH 150
|
||||
@ -1172,8 +1171,6 @@ gtk_entry_ensure_layout (GtkEntry *entry)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
|
||||
PangoAttrList *attrs;
|
||||
|
||||
if (!entry->layout)
|
||||
{
|
||||
entry->layout = gtk_widget_create_pango_layout (widget);
|
||||
@ -1216,10 +1213,10 @@ gtk_entry_draw_text (GtkEntry *entry)
|
||||
{
|
||||
gint *ranges;
|
||||
gint n_ranges, i;
|
||||
gint start_index = unicode_offset_to_index (entry->text,
|
||||
MIN (editable->selection_start_pos, editable->selection_end_pos));
|
||||
gint end_index = unicode_offset_to_index (entry->text,
|
||||
MAX (editable->selection_start_pos, editable->selection_end_pos));
|
||||
gint start_index = g_utf8_offset_to_pointer (entry->text,
|
||||
MIN (editable->selection_start_pos, editable->selection_end_pos)) - entry->text;
|
||||
gint end_index = g_utf8_offset_to_pointer (entry->text,
|
||||
MAX (editable->selection_start_pos, editable->selection_end_pos)) - entry->text;
|
||||
GtkStateType selected_state = editable->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
|
||||
GdkRegion *clip_region = gdk_region_new ();
|
||||
|
||||
@ -1335,7 +1332,7 @@ gtk_entry_find_position (GtkEntry *entry,
|
||||
pango_layout_line_x_to_index (line, x * PANGO_SCALE, &index, &trailing);
|
||||
|
||||
if (trailing)
|
||||
index = unicode_next_utf8 (entry->text + index) - entry->text;
|
||||
index = g_utf8_next_char (entry->text + index) - entry->text;
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -1352,7 +1349,7 @@ gtk_entry_get_cursor_locations (GtkEntry *entry,
|
||||
|
||||
gtk_entry_ensure_layout (entry);
|
||||
|
||||
index = unicode_offset_to_index (entry->text, editable->current_pos);
|
||||
index = g_utf8_offset_to_pointer (entry->text, editable->current_pos) - entry->text;
|
||||
pango_layout_get_cursor_pos (entry->layout, index, &strong_pos, &weak_pos);
|
||||
|
||||
if (strong_x)
|
||||
@ -1467,7 +1464,7 @@ gtk_entry_insert_text (GtkEditable *editable,
|
||||
if (new_text_length < 0)
|
||||
new_text_length = strlen (new_text);
|
||||
|
||||
n_chars = unicode_strlen (new_text, new_text_length);
|
||||
n_chars = g_utf8_strlen (new_text, new_text_length);
|
||||
if (entry->text_max_length > 0 && n_chars + entry->text_length > entry->text_max_length)
|
||||
{
|
||||
gdk_beep ();
|
||||
@ -1497,7 +1494,7 @@ gtk_entry_insert_text (GtkEditable *editable,
|
||||
entry->text = g_realloc (entry->text, entry->text_size);
|
||||
}
|
||||
|
||||
index = unicode_offset_to_index (entry->text, *position);
|
||||
index = g_utf8_offset_to_pointer (entry->text, *position) - entry->text;
|
||||
|
||||
g_memmove (entry->text + index + new_text_length, entry->text + index, entry->n_bytes - index);
|
||||
memcpy (entry->text + index, new_text, new_text_length);
|
||||
@ -1544,8 +1541,8 @@ gtk_entry_delete_text (GtkEditable *editable,
|
||||
(start_pos >= 0) &&
|
||||
(end_pos <= entry->text_length))
|
||||
{
|
||||
gint start_index = unicode_offset_to_index (entry->text, start_pos);
|
||||
gint end_index = unicode_offset_to_index (entry->text, end_pos);
|
||||
gint start_index = g_utf8_offset_to_pointer (entry->text, start_pos) - entry->text;
|
||||
gint end_index = g_utf8_offset_to_pointer (entry->text, end_pos) - entry->text;
|
||||
|
||||
g_memmove (entry->text + start_index, entry->text + end_index, entry->n_bytes - end_index);
|
||||
entry->text_length -= (end_pos - start_pos);
|
||||
@ -1597,8 +1594,8 @@ gtk_entry_get_chars (GtkEditable *editable,
|
||||
start_pos = MIN (entry->text_length, start_pos);
|
||||
end_pos = MIN (entry->text_length, end_pos);
|
||||
|
||||
start_index = unicode_offset_to_index (entry->text, start_pos);
|
||||
end_index = unicode_offset_to_index (entry->text, end_pos);
|
||||
start_index = g_utf8_offset_to_pointer (entry->text, start_pos) - entry->text;
|
||||
end_index = g_utf8_offset_to_pointer (entry->text, end_pos) - entry->text;
|
||||
|
||||
return g_strndup (entry->text + start_index, end_index - start_index);
|
||||
}
|
||||
@ -1613,7 +1610,7 @@ gtk_entry_move_cursor (GtkEditable *editable,
|
||||
|
||||
entry = GTK_ENTRY (editable);
|
||||
|
||||
index = unicode_offset_to_index (entry->text, editable->current_pos);
|
||||
index = g_utf8_offset_to_pointer (entry->text, editable->current_pos) - entry->text;
|
||||
|
||||
/* Horizontal motion */
|
||||
|
||||
@ -1636,7 +1633,7 @@ gtk_entry_move_cursor_visually (GtkEditable *editable,
|
||||
|
||||
entry = GTK_ENTRY (editable);
|
||||
|
||||
index = unicode_offset_to_index (entry->text, editable->current_pos);
|
||||
index = g_utf8_offset_to_pointer (entry->text, editable->current_pos) - entry->text;
|
||||
|
||||
gtk_entry_ensure_layout (entry);
|
||||
|
||||
@ -1659,12 +1656,12 @@ gtk_entry_move_cursor_visually (GtkEditable *editable,
|
||||
break;
|
||||
|
||||
if (new_trailing)
|
||||
index = unicode_next_utf8 (entry->text + new_index) - entry->text;
|
||||
index = g_utf8_next_char (entry->text + new_index) - entry->text;
|
||||
else
|
||||
index = new_index;
|
||||
}
|
||||
|
||||
editable->current_pos = unicode_index_to_offset (entry->text, index);
|
||||
editable->current_pos = g_utf8_pointer_to_offset (entry->text, entry->text + index);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -17,7 +17,6 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unicode.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gtksignal.h"
|
||||
#include "gtkimcontextsimple.h"
|
||||
@ -781,71 +780,14 @@ gtk_im_context_simple_new (void)
|
||||
return GTK_IM_CONTEXT (gtk_type_new (GTK_TYPE_IM_CONTEXT_SIMPLE));
|
||||
}
|
||||
|
||||
/**
|
||||
* unicode_guchar4_to_utf8:
|
||||
* @ch: a ISO10646 character code
|
||||
* @out: output buffer, must have at least 6 bytes of space.
|
||||
*
|
||||
* Convert a single character to utf8
|
||||
*
|
||||
* Return value: number of bytes written
|
||||
**/
|
||||
static int
|
||||
ucs4_to_utf8 (unicode_char_t c, char *outbuf)
|
||||
{
|
||||
size_t len = 0;
|
||||
int first;
|
||||
int i;
|
||||
|
||||
if (c < 0x80)
|
||||
{
|
||||
first = 0;
|
||||
len = 1;
|
||||
}
|
||||
else if (c < 0x800)
|
||||
{
|
||||
first = 0xc0;
|
||||
len = 2;
|
||||
}
|
||||
else if (c < 0x10000)
|
||||
{
|
||||
first = 0xe0;
|
||||
len = 3;
|
||||
}
|
||||
else if (c < 0x200000)
|
||||
{
|
||||
first = 0xf0;
|
||||
len = 4;
|
||||
}
|
||||
else if (c < 0x4000000)
|
||||
{
|
||||
first = 0xf8;
|
||||
len = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
first = 0xfc;
|
||||
len = 6;
|
||||
}
|
||||
|
||||
for (i = len - 1; i > 0; --i)
|
||||
{
|
||||
outbuf[i] = (c & 0x3f) | 0x80;
|
||||
c >>= 6;
|
||||
}
|
||||
outbuf[0] = c | first;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_simple_commit_char (GtkIMContext *context,
|
||||
unicode_char_t ch)
|
||||
gunichar ch)
|
||||
{
|
||||
gchar buf[7];
|
||||
gchar buf[10];
|
||||
gint len;
|
||||
|
||||
len = ucs4_to_utf8 (ch, buf);
|
||||
len = g_unichar_to_utf8 (ch, buf);
|
||||
buf[len] = '\0';
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (context), "commit", &buf);
|
||||
@ -878,7 +820,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);
|
||||
GtkComposeSeq *seq;
|
||||
|
||||
unicode_char_t ch;
|
||||
gunichar ch;
|
||||
int n_compose = 0;
|
||||
int i;
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gdk/gdki18n.h"
|
||||
#include <pango/pango.h>
|
||||
#include <unicode.h>
|
||||
|
||||
|
||||
enum {
|
||||
@ -333,13 +332,13 @@ gtk_label_pattern_to_attrs (GtkLabel *label)
|
||||
{
|
||||
while (*p && *q && *q != '_')
|
||||
{
|
||||
p = unicode_next_utf8 (p);
|
||||
p = g_utf8_next_char (p);
|
||||
q++;
|
||||
}
|
||||
start = p;
|
||||
while (*p && *q && *q == '_')
|
||||
{
|
||||
p = unicode_next_utf8 (p);
|
||||
p = g_utf8_next_char (p);
|
||||
q++;
|
||||
}
|
||||
|
||||
@ -647,7 +646,7 @@ gtk_label_parse_uline (GtkLabel *label,
|
||||
/* Convert text to wide characters */
|
||||
|
||||
new_str = g_new (gchar, strlen (str) + 1);
|
||||
pattern = g_new (gchar, unicode_strlen (str, -1) + 1);
|
||||
pattern = g_new (gchar, g_utf8_strlen (str, -1) + 1);
|
||||
|
||||
underscore = FALSE;
|
||||
|
||||
@ -657,17 +656,18 @@ gtk_label_parse_uline (GtkLabel *label,
|
||||
|
||||
while (*src)
|
||||
{
|
||||
unicode_char_t c;
|
||||
gunichar c;
|
||||
gchar *next_src;
|
||||
|
||||
next_src = unicode_get_utf8 (src, &c);
|
||||
if (!next_src)
|
||||
|
||||
c = g_utf8_get_char (src);
|
||||
if (c == (gunichar)-1)
|
||||
{
|
||||
g_warning ("Invalid input string");
|
||||
g_free (new_str);
|
||||
g_free (pattern);
|
||||
return GDK_VoidSymbol;
|
||||
}
|
||||
next_src = g_utf8_next_char (src);
|
||||
|
||||
if (underscore)
|
||||
{
|
||||
|
@ -47,8 +47,6 @@ gtk_text_view_tab_array_unref(GtkTextTabArray *tab_array)
|
||||
* API, eventually should just use libunicode/Pango directly)
|
||||
*/
|
||||
|
||||
#include <unicode.h>
|
||||
|
||||
#if 0
|
||||
static void
|
||||
trigger_efence(const gchar *str, gint len)
|
||||
@ -73,7 +71,7 @@ gint
|
||||
gtk_text_view_num_utf_chars(const gchar *str, gint len)
|
||||
{
|
||||
trigger_efence(str, len);
|
||||
return unicode_strlen(str, len);
|
||||
return g_utf8_strlen(str, len);
|
||||
}
|
||||
|
||||
/* FIXME we need a version of this function with error handling, so we
|
||||
@ -82,19 +80,18 @@ gtk_text_view_num_utf_chars(const gchar *str, gint len)
|
||||
gint
|
||||
gtk_text_utf_to_unichar(const gchar *str, GtkTextUniChar *chPtr)
|
||||
{
|
||||
unicode_char_t ch;
|
||||
gchar *end;
|
||||
gunichar ch;
|
||||
|
||||
end = unicode_get_utf8(str, &ch);
|
||||
ch = g_utf8_get_char (str);
|
||||
|
||||
if (end == NULL)
|
||||
if (ch == (gunichar)-1)
|
||||
g_error("Bad UTF8, need to add some error checking so this doesn't crash the program");
|
||||
|
||||
*chPtr = ch;
|
||||
|
||||
trigger_efence(str, end - str);
|
||||
|
||||
return end - str;
|
||||
return g_utf8_next_char (str) - str;
|
||||
}
|
||||
|
||||
gchar*
|
||||
@ -104,7 +101,7 @@ gtk_text_utf_prev(const gchar *str, const gchar *start)
|
||||
|
||||
trigger_efence(start, str - start);
|
||||
|
||||
retval = unicode_previous_utf8(start, str);
|
||||
retval = g_utf8_find_prev_char (start, str);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "x11/gdkx.h"
|
||||
#elif defined (GDK_WINDOWING_WIN32)
|
||||
#include "win32/gdkwin32.h"
|
||||
#elif defined (GDK_WINDOWING_FB)
|
||||
#include "linux-fb/gdkfb.h"
|
||||
#elif defined (GDK_WINDOWING_NANOX)
|
||||
#include "nanox/gdkprivate-nanox.h"
|
||||
#endif
|
||||
@ -1828,9 +1826,6 @@ gtk_window_compute_default_size (GtkWindow *window,
|
||||
*width = info->width > 0 ? info->width : *width;
|
||||
*height = info->height > 0 ? info->height : *height;
|
||||
}
|
||||
|
||||
*width = MIN(*width, gdk_screen_width());
|
||||
*height = MIN(*width, gdk_screen_height());
|
||||
}
|
||||
|
||||
/* Constrain a window size to obey the hints passed in geometry
|
||||
|
@ -8510,7 +8510,7 @@ do_exit (GtkWidget *widget, GtkWidget *window)
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
void
|
||||
create_main_window (void)
|
||||
{
|
||||
struct {
|
||||
@ -8627,7 +8627,6 @@ create_main_window (void)
|
||||
for (i = 0; i < nbuttons; i++)
|
||||
{
|
||||
button = gtk_button_new_with_label (buttons[i].label);
|
||||
gtk_widget_set_name(button, buttons[i].label);
|
||||
if (buttons[i].func)
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
@ -8654,8 +8653,6 @@ create_main_window (void)
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
int
|
||||
@ -8685,7 +8682,9 @@ main (int argc, char *argv[])
|
||||
"debug_msg",
|
||||
1,
|
||||
GTK_TYPE_STRING, "GtkWidgetClass <ctrl><release>9 test");
|
||||
|
||||
create_main_window ();
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unicode.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
@ -608,7 +607,6 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename)
|
||||
{
|
||||
gint count;
|
||||
char *leftover, *next;
|
||||
unicode_char_t wc;
|
||||
int to_read = 2047 - remaining;
|
||||
|
||||
count = fread (buf + remaining, 1, to_read, f);
|
||||
@ -621,7 +619,7 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename)
|
||||
if (!*leftover)
|
||||
break;
|
||||
|
||||
next = unicode_get_utf8 (next, &wc);
|
||||
next = g_utf8_next_char (next);
|
||||
}
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <glib.h>
|
||||
#include <pango/pango.h>
|
||||
#include "gdkprivate-fb.h"
|
||||
#include <unicode.h>
|
||||
#include <fribidi/fribidi.h>
|
||||
|
||||
PangoGlyph
|
||||
@ -85,22 +84,6 @@ static PangoGlyph conv_ucs4 (CharCache *cache,
|
||||
Charset *charset,
|
||||
const char *input);
|
||||
|
||||
/* From pango/utils.h */
|
||||
typedef guint16 GUChar2;
|
||||
typedef guint32 GUChar4;
|
||||
|
||||
gboolean _pango_utf8_iterate (const char *cur,
|
||||
const char **next,
|
||||
GUChar4 *wc_out);
|
||||
GUChar2 *_pango_utf8_to_ucs2 (const char *str,
|
||||
gint len);
|
||||
GUChar4 *_pango_utf8_to_ucs4 (const char *str,
|
||||
int len);
|
||||
int _pango_guchar4_to_utf8 (GUChar4 c,
|
||||
char *outbuf);
|
||||
int _pango_utf8_len (const char *str,
|
||||
gint limit);
|
||||
|
||||
#include "tables-big.i"
|
||||
|
||||
static PangoEngineInfo script_engines[] = {
|
||||
@ -189,7 +172,7 @@ char_cache_free (CharCache *cache)
|
||||
}
|
||||
|
||||
PangoGlyph
|
||||
find_char (CharCache *cache, PangoFont *font, GUChar4 wc, const char *input)
|
||||
find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input)
|
||||
{
|
||||
return FT_Get_Char_Index(PANGO_FB_FONT(font)->ftf, wc);
|
||||
}
|
||||
@ -231,15 +214,13 @@ conv_8bit (CharCache *cache,
|
||||
{
|
||||
iconv_t cd;
|
||||
char outbuf;
|
||||
const char *p;
|
||||
|
||||
const char *inptr = input;
|
||||
size_t inbytesleft;
|
||||
char *outptr = &outbuf;
|
||||
size_t outbytesleft = 1;
|
||||
|
||||
_pango_utf8_iterate (input, &p, NULL);
|
||||
inbytesleft = p - input;
|
||||
inbytesleft = g_utf8_next_char (input) - input;
|
||||
|
||||
cd = find_converter (cache, charset);
|
||||
|
||||
@ -255,15 +236,13 @@ conv_euc (CharCache *cache,
|
||||
{
|
||||
iconv_t cd;
|
||||
char outbuf[2];
|
||||
const char *p;
|
||||
|
||||
const char *inptr = input;
|
||||
size_t inbytesleft;
|
||||
char *outptr = outbuf;
|
||||
size_t outbytesleft = 2;
|
||||
|
||||
_pango_utf8_iterate (input, &p, NULL);
|
||||
inbytesleft = p - input;
|
||||
inbytesleft = g_utf8_next_char (input) - input;
|
||||
|
||||
cd = find_converter (cache, charset);
|
||||
|
||||
@ -280,10 +259,7 @@ conv_ucs4 (CharCache *cache,
|
||||
Charset *charset,
|
||||
const char *input)
|
||||
{
|
||||
GUChar4 wc;
|
||||
|
||||
unicode_get_utf8 (input, &wc);
|
||||
return wc;
|
||||
return g_utf8_get_char (input);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -332,7 +308,6 @@ basic_engine_shape (PangoFont *font,
|
||||
int n_chars;
|
||||
int i;
|
||||
const char *p;
|
||||
const char *next;
|
||||
|
||||
CharCache *cache;
|
||||
|
||||
@ -343,19 +318,19 @@ basic_engine_shape (PangoFont *font,
|
||||
|
||||
cache = get_char_cache (font);
|
||||
|
||||
n_chars = unicode_strlen (text, length);
|
||||
n_chars = g_utf8_strlen (text, length);
|
||||
pango_glyph_string_set_size (glyphs, n_chars);
|
||||
|
||||
p = text;
|
||||
for (i=0; i < n_chars; i++)
|
||||
{
|
||||
GUChar4 wc;
|
||||
gunichar wc;
|
||||
FriBidiChar mirrored_ch;
|
||||
PangoGlyph index;
|
||||
char buf[6];
|
||||
const char *input;
|
||||
|
||||
_pango_utf8_iterate (p, &next, &wc);
|
||||
wc = g_utf8_get_char (p);
|
||||
|
||||
input = p;
|
||||
if (analysis->level % 2)
|
||||
@ -363,7 +338,7 @@ basic_engine_shape (PangoFont *font,
|
||||
{
|
||||
wc = mirrored_ch;
|
||||
|
||||
_pango_guchar4_to_utf8 (wc, buf);
|
||||
g_unichar_to_utf8 (wc, buf);
|
||||
input = buf;
|
||||
}
|
||||
|
||||
@ -378,7 +353,7 @@ basic_engine_shape (PangoFont *font,
|
||||
{
|
||||
set_glyph (font, glyphs, i, p - text, index);
|
||||
|
||||
if (unicode_type (wc) == UNICODE_NON_SPACING_MARK)
|
||||
if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
@ -402,7 +377,7 @@ basic_engine_shape (PangoFont *font,
|
||||
set_glyph (font, glyphs, i, p - text, pango_fb_get_unknown_glyph (font));
|
||||
}
|
||||
|
||||
p = next;
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
|
||||
/* Simple bidi support... may have separate modules later */
|
||||
@ -434,13 +409,13 @@ basic_engine_get_coverage (PangoFont *font,
|
||||
{
|
||||
CharCache *cache = get_char_cache (font);
|
||||
PangoCoverage *result = pango_coverage_new ();
|
||||
GUChar4 wc;
|
||||
gunichar wc;
|
||||
|
||||
for (wc = 0; wc < 65536; wc++)
|
||||
{
|
||||
char buf[6];
|
||||
|
||||
_pango_guchar4_to_utf8 (wc, buf);
|
||||
g_unichar_to_utf8 (wc, buf);
|
||||
if (find_char (cache, font, wc, buf))
|
||||
pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
|
||||
}
|
||||
|
@ -8510,7 +8510,7 @@ do_exit (GtkWidget *widget, GtkWidget *window)
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
void
|
||||
create_main_window (void)
|
||||
{
|
||||
struct {
|
||||
@ -8627,7 +8627,6 @@ create_main_window (void)
|
||||
for (i = 0; i < nbuttons; i++)
|
||||
{
|
||||
button = gtk_button_new_with_label (buttons[i].label);
|
||||
gtk_widget_set_name(button, buttons[i].label);
|
||||
if (buttons[i].func)
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
@ -8654,8 +8653,6 @@ create_main_window (void)
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
int
|
||||
@ -8685,7 +8682,9 @@ main (int argc, char *argv[])
|
||||
"debug_msg",
|
||||
1,
|
||||
GTK_TYPE_STRING, "GtkWidgetClass <ctrl><release>9 test");
|
||||
|
||||
create_main_window ();
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unicode.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
@ -608,7 +607,6 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename)
|
||||
{
|
||||
gint count;
|
||||
char *leftover, *next;
|
||||
unicode_char_t wc;
|
||||
int to_read = 2047 - remaining;
|
||||
|
||||
count = fread (buf + remaining, 1, to_read, f);
|
||||
@ -621,7 +619,7 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename)
|
||||
if (!*leftover)
|
||||
break;
|
||||
|
||||
next = unicode_get_utf8 (next, &wc);
|
||||
next = g_utf8_next_char (next);
|
||||
}
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
|
||||
|
Loading…
Reference in New Issue
Block a user