diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-10-01 23:18:30 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-10-01 23:18:30 +0000 |
commit | 637a466d5ca1fbda2acbf5d52779dd5097b5a9e2 (patch) | |
tree | 781d1f31b75758b3b9a3d19ce4a7c55349b2ba82 /gdk | |
parent | 74d88d870aea60625b8f1ed522e86faa223ca487 (diff) | |
download | gtk+-637a466d5ca1fbda2acbf5d52779dd5097b5a9e2.tar.gz |
Started
Fri Oct 1 18:03:36 1999 Owen Taylor <otaylor@redhat.com>
* docs/Changes-1.4.txt: Started
* gtk/Makefile.am (gdk_headers): Include all the new headers.
* gdk/*.h gdk/*.c: Split gdk.h into lots of itty-bitty little pieces.
* gdk/gdkprivate.h gdk/gdkcc.c: Moved GdkColorContext private
into C file.
* gdkinput.h gdkinputprivate.h - renamed the internal gdkinput
header to gdkinputprivate.h.
* gdk/gdk.h gdk/gdk.c: Removed gdk_time* functions which have been
unused since before 1.2.
Diffstat (limited to 'gdk')
59 files changed, 2721 insertions, 2505 deletions
diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 39f07bbfaa..5962d18c81 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -30,15 +30,36 @@ libgdk_la_LDFLAGS = @STRIP_BEGIN@ \ # # setup source file variables # +# # GDK header files for public installation (non-generated) +# +# Note: files added here may need to be be propagated to gdk_headers in gtk/Makefile.am +# gdk_public_h_sources = @STRIP_BEGIN@ \ gdk.h \ + gdkcc.h \ + gdkcolor.h \ + gdkcursor.h \ gdkcursors.h \ - gdkrgb.h \ - gdki18n.h \ + gdkdnd.h \ + gdkdrawable.h \ + gdkevents.h \ + gdkfont.h \ + gdkgc.h \ gdkkeysyms.h \ + gdki18n.h \ + gdkim.h \ + gdkimage.h \ + gdkinput.h \ + gdkpixmap.h \ gdkprivate.h \ + gdkproperty.h \ + gdkregion.h \ + gdkrgb.h \ + gdkselection.h \ gdktypes.h \ + gdkvisual.h \ + gdkwindow.h \ gdkx.h \ @STRIP_END@ gdk_c_sources = @STRIP_BEGIN@ \ @@ -44,17 +44,11 @@ #include <X11/Xutil.h> #include <X11/Xmu/WinUtil.h> #include <X11/cursorfont.h> -#include "gdk.h" -#include "gdkprivate.h" -#include "gdkinput.h" -#include "gdkx.h" -#include "gdki18n.h" -#include "gdkkeysyms.h" -#ifndef X_GETTIMEOFDAY -#define X_GETTIMEOFDAY(tv) gettimeofday (tv, NULL) -#endif /* X_GETTIMEOFDAY */ +#include "gdk.h" +#include "gdkprivate.h" +#include "gdkinputprivate.h" typedef struct _GdkPredicate GdkPredicate; typedef struct _GdkErrorTrap GdkErrorTrap; @@ -97,23 +91,6 @@ static int gdk_initialized = 0; /* 1 if the library is initialized, * 0 otherwise. */ -static struct timeval start; /* The time at which the library was - * last initialized. - */ -static struct timeval timer; /* Timeout interval to use in the call - * to "select". This is used in - * conjunction with "timerp" to create - * a maximum time to wait for an event - * to arrive. - */ -static struct timeval *timerp; /* The actual timer passed to "select" - * This may be NULL, in which case - * "select" will block until an event - * arrives. - */ -static guint32 timer_val; /* The timeout length as specified by - * the user in milliseconds. - */ static gint autorepeat; static GSList *gdk_error_traps = NULL; /* List of error traps */ @@ -181,8 +158,6 @@ gdk_init_check (int *argc, argv_orig[argc_orig] = NULL; } - X_GETTIMEOFDAY (&start); - gdk_display_name = NULL; XSetErrorHandler (gdk_x_error); @@ -420,10 +395,6 @@ gdk_init_check (int *argc, XGetKeyboardControl (gdk_display, &keyboard_state); autorepeat = keyboard_state.global_auto_repeat; - timer.tv_sec = 0; - timer.tv_usec = 0; - timerp = NULL; - g_atexit (gdk_exit_func); gdk_events_init (); @@ -493,112 +464,6 @@ gdk_get_use_xshm (void) /* *-------------------------------------------------------------- - * gdk_time_get - * - * Get the number of milliseconds since the library was - * initialized. - * - * Arguments: - * - * Results: - * The time since the library was initialized is returned. - * This time value is accurate to milliseconds even though - * a more accurate time down to the microsecond could be - * returned. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_time_get (void) -{ - struct timeval end; - struct timeval elapsed; - guint32 milliseconds; - - X_GETTIMEOFDAY (&end); - - if (start.tv_usec > end.tv_usec) - { - end.tv_usec += 1000000; - end.tv_sec--; - } - elapsed.tv_sec = end.tv_sec - start.tv_sec; - elapsed.tv_usec = end.tv_usec - start.tv_usec; - - milliseconds = (elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000); - - return milliseconds; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_get - * - * Returns the current timer. - * - * Arguments: - * - * Results: - * Returns the current timer interval. This interval is - * in units of milliseconds. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_timer_get (void) -{ - return timer_val; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_set - * - * Sets the timer interval. - * - * Arguments: - * "milliseconds" is the new value for the timer. - * - * Results: - * - * Side effects: - * Calls to "gdk_event_get" will last for a maximum - * of time of "milliseconds". However, a value of 0 - * milliseconds will cause "gdk_event_get" to block - * indefinately until an event is received. - * - *-------------------------------------------------------------- - */ - -void -gdk_timer_set (guint32 milliseconds) -{ - timer_val = milliseconds; - timer.tv_sec = milliseconds / 1000; - timer.tv_usec = (milliseconds % 1000) * 1000; - -} - -void -gdk_timer_enable (void) -{ - timerp = &timer; -} - -void -gdk_timer_disable (void) -{ - timerp = NULL; -} - -/* - *-------------------------------------------------------------- * gdk_pointer_grab * * Grabs the pointer to a specific window @@ -27,8 +27,25 @@ #ifndef __GDK_H__ #define __GDK_H__ - +#include <gdk/gdkcc.h> +#include <gdk/gdkcolor.h> +#include <gdk/gdkcursor.h> +#include <gdk/gdkdnd.h> +#include <gdk/gdkdrawable.h> +#include <gdk/gdkevents.h> +#include <gdk/gdkfont.h> +#include <gdk/gdkgc.h> +#include <gdk/gdkim.h> +#include <gdk/gdkimage.h> +#include <gdk/gdkinput.h> +#include <gdk/gdkpixmap.h> +#include <gdk/gdkproperty.h> +#include <gdk/gdkregion.h> +#include <gdk/gdkrgb.h> +#include <gdk/gdkselection.h> #include <gdk/gdktypes.h> +#include <gdk/gdkvisual.h> +#include <gdk/gdkwindow.h> #ifdef __cplusplus extern "C" { @@ -51,34 +68,11 @@ void gdk_error_trap_push (void); gint gdk_error_trap_pop (void); -gboolean gdk_events_pending (void); -GdkEvent* gdk_event_get (void); - -GdkEvent* gdk_event_peek (void); -GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window); -void gdk_event_put (GdkEvent *event); - -GdkEvent* gdk_event_copy (GdkEvent *event); -void gdk_event_free (GdkEvent *event); -guint32 gdk_event_get_time (GdkEvent *event); - -void gdk_event_handler_set (GdkEventFunc func, - gpointer data, - GDestroyNotify notify); - -void gdk_set_show_events (gint show_events); void gdk_set_use_xshm (gint use_xshm); -gint gdk_get_show_events (void); gint gdk_get_use_xshm (void); gchar* gdk_get_display (void); -guint32 gdk_time_get (void); -guint32 gdk_timer_get (void); -void gdk_timer_set (guint32 milliseconds); -void gdk_timer_enable (void); -void gdk_timer_disable (void); - gint gdk_input_add_full (gint source, GdkInputCondition condition, GdkInputFunction function, @@ -117,707 +111,6 @@ void gdk_beep (void); void gdk_key_repeat_disable (void); void gdk_key_repeat_restore (void); - -/* Visuals - */ -gint gdk_visual_get_best_depth (void); -GdkVisualType gdk_visual_get_best_type (void); -GdkVisual* gdk_visual_get_system (void); -GdkVisual* gdk_visual_get_best (void); -GdkVisual* gdk_visual_get_best_with_depth (gint depth); -GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type); -GdkVisual* gdk_visual_get_best_with_both (gint depth, - GdkVisualType visual_type); - -/* Actually, these are no-ops... */ -GdkVisual* gdk_visual_ref (GdkVisual *visual); -void gdk_visual_unref (GdkVisual *visual); - -void gdk_query_depths (gint **depths, - gint *count); -void gdk_query_visual_types (GdkVisualType **visual_types, - gint *count); - -GList* gdk_list_visuals (void); - - -/* Windows - */ -GdkWindow* gdk_window_new (GdkWindow *parent, - GdkWindowAttr *attributes, - gint attributes_mask); - -void gdk_window_destroy (GdkWindow *window); -GdkWindow* gdk_window_ref (GdkWindow *window); -void gdk_window_unref (GdkWindow *window); - -GdkWindow* gdk_window_at_pointer (gint *win_x, - gint *win_y); -void gdk_window_show (GdkWindow *window); -void gdk_window_hide (GdkWindow *window); -void gdk_window_withdraw (GdkWindow *window); -void gdk_window_move (GdkWindow *window, - gint x, - gint y); -void gdk_window_resize (GdkWindow *window, - gint width, - gint height); -void gdk_window_move_resize (GdkWindow *window, - gint x, - gint y, - gint width, - gint height); -void gdk_window_reparent (GdkWindow *window, - GdkWindow *new_parent, - gint x, - gint y); -void gdk_window_clear (GdkWindow *window); -void gdk_window_clear_area (GdkWindow *window, - gint x, - gint y, - gint width, - gint height); -void gdk_window_clear_area_e(GdkWindow *window, - gint x, - gint y, - gint width, - gint height); -void gdk_window_copy_area (GdkWindow *window, - GdkGC *gc, - gint x, - gint y, - GdkWindow *source_window, - gint source_x, - gint source_y, - gint width, - gint height); -void gdk_window_raise (GdkWindow *window); -void gdk_window_lower (GdkWindow *window); - -void gdk_window_set_user_data (GdkWindow *window, - gpointer user_data); -void gdk_window_set_override_redirect(GdkWindow *window, - gboolean override_redirect); - -void gdk_window_add_filter (GdkWindow *window, - GdkFilterFunc function, - gpointer data); -void gdk_window_remove_filter (GdkWindow *window, - GdkFilterFunc function, - gpointer data); - -/* - * This allows for making shaped (partially transparent) windows - * - cool feature, needed for Drag and Drag for example. - * The shape_mask can be the mask - * from gdk_pixmap_create_from_xpm. Stefan Wille - */ -void gdk_window_shape_combine_mask (GdkWindow *window, - GdkBitmap *shape_mask, - gint offset_x, - gint offset_y); -/* - * This routine allows you to quickly take the shapes of all the child windows - * of a window and use their shapes as the shape mask for this window - useful - * for container windows that dont want to look like a big box - * - * - Raster - */ -void gdk_window_set_child_shapes (GdkWindow *window); - -/* - * This routine allows you to merge (ie ADD) child shapes to your - * own window's shape keeping its current shape and ADDING the child - * shapes to it. - * - * - Raster - */ -void gdk_window_merge_child_shapes (GdkWindow *window); - -/* - * Check if a window has been shown, and whether all it's - * parents up to a toplevel have been shown, respectively. - * Note that a window that is_viewable below is not necessarily - * viewable in the X sense. - */ -gboolean gdk_window_is_visible (GdkWindow *window); -gboolean gdk_window_is_viewable (GdkWindow *window); - -/* Set static bit gravity on the parent, and static - * window gravity on all children. - */ -gboolean gdk_window_set_static_gravities (GdkWindow *window, - gboolean use_static); -/* - * The following function adds a global filter for all client - * messages of type message_type - */ -void gdk_add_client_message_filter (GdkAtom message_type, - GdkFilterFunc func, - gpointer data); - -/* Drag and Drop */ - -GdkDragContext * gdk_drag_context_new (void); -void gdk_drag_context_ref (GdkDragContext *context); -void gdk_drag_context_unref (GdkDragContext *context); - -/* Destination side */ - -void gdk_drag_status (GdkDragContext *context, - GdkDragAction action, - guint32 time); -void gdk_drop_reply (GdkDragContext *context, - gboolean ok, - guint32 time); -void gdk_drop_finish (GdkDragContext *context, - gboolean success, - guint32 time); -GdkAtom gdk_drag_get_selection (GdkDragContext *context); - -/* Source side */ - -GdkDragContext * gdk_drag_begin (GdkWindow *window, - GList *targets); -guint32 gdk_drag_get_protocol (guint32 xid, - GdkDragProtocol *protocol); -void gdk_drag_find_window (GdkDragContext *context, - GdkWindow *drag_window, - gint x_root, - gint y_root, - GdkWindow **dest_window, - GdkDragProtocol *protocol); -gboolean gdk_drag_motion (GdkDragContext *context, - GdkWindow *dest_window, - GdkDragProtocol protocol, - gint x_root, - gint y_root, - GdkDragAction suggested_action, - GdkDragAction possible_actions, - guint32 time); -void gdk_drag_drop (GdkDragContext *context, - guint32 time); -void gdk_drag_abort (GdkDragContext *context, - guint32 time); - -GdkAtom gdk_drag_get_selection (GdkDragContext *context); - -/* GdkWindow */ - -void gdk_window_set_hints (GdkWindow *window, - gint x, - gint y, - gint min_width, - gint min_height, - gint max_width, - gint max_height, - gint flags); -void gdk_window_set_geometry_hints (GdkWindow *window, - GdkGeometry *geometry, - GdkWindowHints flags); -void gdk_set_sm_client_id (const gchar *sm_client_id); - - -void gdk_window_set_title (GdkWindow *window, - const gchar *title); -void gdk_window_set_role (GdkWindow *window, - const gchar *role); -void gdk_window_set_transient_for (GdkWindow *window, - GdkWindow *leader); -void gdk_window_set_background (GdkWindow *window, - GdkColor *color); -void gdk_window_set_back_pixmap (GdkWindow *window, - GdkPixmap *pixmap, - gint parent_relative); -void gdk_window_set_cursor (GdkWindow *window, - GdkCursor *cursor); -void gdk_window_set_colormap (GdkWindow *window, - GdkColormap *colormap); -void gdk_window_get_user_data (GdkWindow *window, - gpointer *data); -void gdk_window_get_geometry (GdkWindow *window, - gint *x, - gint *y, - gint *width, - gint *height, - gint *depth); -void gdk_window_get_position (GdkWindow *window, - gint *x, - gint *y); -void gdk_window_get_size (GdkWindow *window, - gint *width, - gint *height); -GdkVisual* gdk_window_get_visual (GdkWindow *window); -GdkColormap* gdk_window_get_colormap (GdkWindow *window); -GdkWindowType gdk_window_get_type (GdkWindow *window); -gint gdk_window_get_origin (GdkWindow *window, - gint *x, - gint *y); -gboolean gdk_window_get_deskrelative_origin (GdkWindow *window, - gint *x, - gint *y); -void gdk_window_get_root_origin (GdkWindow *window, - gint *x, - gint *y); -GdkWindow* gdk_window_get_pointer (GdkWindow *window, - gint *x, - gint *y, - GdkModifierType *mask); -GdkWindow* gdk_window_get_parent (GdkWindow *window); -GdkWindow* gdk_window_get_toplevel (GdkWindow *window); -GList* gdk_window_get_children (GdkWindow *window); -GdkEventMask gdk_window_get_events (GdkWindow *window); -void gdk_window_set_events (GdkWindow *window, - GdkEventMask event_mask); - -void gdk_window_set_icon (GdkWindow *window, - GdkWindow *icon_window, - GdkPixmap *pixmap, - GdkBitmap *mask); -void gdk_window_set_icon_name (GdkWindow *window, - gchar *name); -void gdk_window_set_group (GdkWindow *window, - GdkWindow *leader); -void gdk_window_set_decorations (GdkWindow *window, - GdkWMDecoration decorations); -void gdk_window_set_functions (GdkWindow *window, - GdkWMFunction functions); -GList * gdk_window_get_toplevels (void); - -void gdk_window_register_dnd (GdkWindow *window); - -void gdk_drawable_set_data (GdkDrawable *drawable, - const gchar *key, - gpointer data, - GDestroyNotify destroy_func); - - -/* Cursors - */ -GdkCursor* gdk_cursor_new (GdkCursorType cursor_type); -GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source, - GdkPixmap *mask, - GdkColor *fg, - GdkColor *bg, - gint x, - gint y); -void gdk_cursor_destroy (GdkCursor *cursor); - - -/* GCs - */ -GdkGC* gdk_gc_new (GdkWindow *window); -GdkGC* gdk_gc_new_with_values (GdkWindow *window, - GdkGCValues *values, - GdkGCValuesMask values_mask); -GdkGC* gdk_gc_ref (GdkGC *gc); -void gdk_gc_unref (GdkGC *gc); -void gdk_gc_destroy (GdkGC *gc); -void gdk_gc_get_values (GdkGC *gc, - GdkGCValues *values); -void gdk_gc_set_foreground (GdkGC *gc, - GdkColor *color); -void gdk_gc_set_background (GdkGC *gc, - GdkColor *color); -void gdk_gc_set_font (GdkGC *gc, - GdkFont *font); -void gdk_gc_set_function (GdkGC *gc, - GdkFunction function); -void gdk_gc_set_fill (GdkGC *gc, - GdkFill fill); -void gdk_gc_set_tile (GdkGC *gc, - GdkPixmap *tile); -void gdk_gc_set_stipple (GdkGC *gc, - GdkPixmap *stipple); -void gdk_gc_set_ts_origin (GdkGC *gc, - gint x, - gint y); -void gdk_gc_set_clip_origin (GdkGC *gc, - gint x, - gint y); -void gdk_gc_set_clip_mask (GdkGC *gc, - GdkBitmap *mask); -void gdk_gc_set_clip_rectangle (GdkGC *gc, - GdkRectangle *rectangle); -void gdk_gc_set_clip_region (GdkGC *gc, - GdkRegion *region); -void gdk_gc_set_subwindow (GdkGC *gc, - GdkSubwindowMode mode); -void gdk_gc_set_exposures (GdkGC *gc, - gint exposures); -void gdk_gc_set_line_attributes (GdkGC *gc, - gint line_width, - GdkLineStyle line_style, - GdkCapStyle cap_style, - GdkJoinStyle join_style); -void gdk_gc_set_dashes (GdkGC *gc, - gint dash_offset, - gchar dash_list[], - gint n); -void gdk_gc_copy (GdkGC *dst_gc, - GdkGC *src_gc); - - -/* Pixmaps - */ -GdkPixmap* gdk_pixmap_new (GdkWindow *window, - gint width, - gint height, - gint depth); -#ifdef GDK_WINDOWING_WIN32 -GdkPixmap* gdk_pixmap_create_on_shared_image - (GdkImage **image_return, - GdkWindow *window, - GdkVisual *visual, - gint width, - gint height, - gint depth); -#endif -GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window, - const gchar *data, - gint width, - gint height); -GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window, - const gchar *data, - gint width, - gint height, - gint depth, - GdkColor *fg, - GdkColor *bg); -GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window, - GdkBitmap **mask, - GdkColor *transparent_color, - const gchar *filename); -GdkPixmap* gdk_pixmap_colormap_create_from_xpm ( - GdkWindow *window, - GdkColormap *colormap, - GdkBitmap **mask, - GdkColor *transparent_color, - const gchar *filename); -GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window, - GdkBitmap **mask, - GdkColor *transparent_color, - gchar **data); -GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d ( - GdkWindow *window, - GdkColormap *colormap, - GdkBitmap **mask, - GdkColor *transparent_color, - gchar **data); -GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap); -void gdk_pixmap_unref (GdkPixmap *pixmap); - -GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap); -void gdk_bitmap_unref (GdkBitmap *pixmap); - - -/* Images - */ -GdkImage* gdk_image_new_bitmap(GdkVisual *visual, - gpointer data, - gint width, - gint height); -GdkImage* gdk_image_new (GdkImageType type, - GdkVisual *visual, - gint width, - gint height); -#ifdef GDK_WINDOWING_WIN32 -GdkImage* gdk_image_bitmap_new(GdkImageType type, - GdkVisual *visual, - gint width, - gint height); -#endif -GdkImage* gdk_image_get (GdkWindow *window, - gint x, - gint y, - gint width, - gint height); -void gdk_image_put_pixel (GdkImage *image, - gint x, - gint y, - guint32 pixel); -guint32 gdk_image_get_pixel (GdkImage *image, - gint x, - gint y); -void gdk_image_destroy (GdkImage *image); - - -/* Color - */ -GdkColormap* gdk_colormap_new (GdkVisual *visual, - gint allocate); -GdkColormap* gdk_colormap_ref (GdkColormap *cmap); -void gdk_colormap_unref (GdkColormap *cmap); - -GdkColormap* gdk_colormap_get_system (void); -gint gdk_colormap_get_system_size (void); - -void gdk_colormap_change (GdkColormap *colormap, - gint ncolors); - -gint gdk_colormap_alloc_colors (GdkColormap *colormap, - GdkColor *colors, - gint ncolors, - gboolean writeable, - gboolean best_match, - gboolean *success); -gboolean gdk_colormap_alloc_color (GdkColormap *colormap, - GdkColor *color, - gboolean writeable, - gboolean best_match); -void gdk_colormap_free_colors (GdkColormap *colormap, - GdkColor *colors, - gint ncolors); - -GdkVisual* gdk_colormap_get_visual (GdkColormap *colormap); - -GdkColor* gdk_color_copy (GdkColor *color); -void gdk_color_free (GdkColor *color); - -gboolean gdk_color_parse (const gchar *spec, - GdkColor *color); -guint gdk_color_hash (const GdkColor *colora); -gint gdk_color_equal (const GdkColor *colora, - const GdkColor *colorb); - - -/* The following functions are deprecated */ -void gdk_colors_store (GdkColormap *colormap, - GdkColor *colors, - gint ncolors); -gboolean gdk_colors_alloc (GdkColormap *colormap, - gint contiguous, - gulong *planes, - gint nplanes, - gulong *pixels, - gint npixels); -void gdk_colors_free (GdkColormap *colormap, - gulong *pixels, - gint npixels, - gulong planes); -gboolean gdk_color_white (GdkColormap *colormap, - GdkColor *color); -gboolean gdk_color_black (GdkColormap *colormap, - GdkColor *color); -gboolean gdk_color_alloc (GdkColormap *colormap, - GdkColor *color); -gboolean gdk_color_change (GdkColormap *colormap, - GdkColor *color); - - -/* Fonts - */ -GdkFont* gdk_font_load (const gchar *font_name); -GdkFont* gdk_fontset_load (gchar *fontset_name); -GdkFont* gdk_font_ref (GdkFont *font); -void gdk_font_unref (GdkFont *font); -gint gdk_font_id (const GdkFont *font); -gint gdk_font_equal (const GdkFont *fonta, - const GdkFont *fontb); -gint gdk_string_width (GdkFont *font, - const gchar *string); -gint gdk_text_width (GdkFont *font, - const gchar *text, - gint text_length); -gint gdk_text_width_wc (GdkFont *font, - const GdkWChar *text, - gint text_length); -gint gdk_char_width (GdkFont *font, - gchar character); -gint gdk_char_width_wc (GdkFont *font, - GdkWChar character); -gint gdk_string_measure (GdkFont *font, - const gchar *string); -gint gdk_text_measure (GdkFont *font, - const gchar *text, - gint text_length); -gint gdk_char_measure (GdkFont *font, - gchar character); -gint gdk_string_height (GdkFont *font, - const gchar *string); -gint gdk_text_height (GdkFont *font, - const gchar *text, - gint text_length); -gint gdk_char_height (GdkFont *font, - gchar character); - -void gdk_text_extents (GdkFont *font, - const gchar *text, - gint text_length, - gint *lbearing, - gint *rbearing, - gint *width, - gint *ascent, - gint *descent); -void gdk_text_extents_wc (GdkFont *font, - const GdkWChar *text, - gint text_length, - gint *lbearing, - gint *rbearing, - gint *width, - gint *ascent, - gint *descent); -void gdk_string_extents (GdkFont *font, - const gchar *string, - gint *lbearing, - gint *rbearing, - gint *width, - gint *ascent, - gint *descent); - -/* Drawing - */ -void gdk_draw_point (GdkDrawable *drawable, - GdkGC *gc, - gint x, - gint y); -void gdk_draw_line (GdkDrawable *drawable, - GdkGC *gc, - gint x1, - gint y1, - gint x2, - gint y2); -void gdk_draw_rectangle (GdkDrawable *drawable, - GdkGC *gc, - gint filled, - gint x, - gint y, - gint width, - gint height); -void gdk_draw_arc (GdkDrawable *drawable, - GdkGC *gc, - gint filled, - gint x, - gint y, - gint width, - gint height, - gint angle1, - gint angle2); -void gdk_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gint filled, - GdkPoint *points, - gint npoints); -void gdk_draw_string (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *string); -void gdk_draw_text (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const gchar *text, - gint text_length); -void gdk_draw_text_wc (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - gint x, - gint y, - const GdkWChar *text, - gint text_length); -void gdk_draw_pixmap (GdkDrawable *drawable, - GdkGC *gc, - GdkDrawable *src, - gint xsrc, - gint ysrc, - gint xdest, - gint ydest, - gint width, - gint height); -void gdk_draw_bitmap (GdkDrawable *drawable, - GdkGC *gc, - GdkDrawable *src, - gint xsrc, - gint ysrc, - gint xdest, - gint ydest, - gint width, - gint height); -void gdk_draw_image (GdkDrawable *drawable, - GdkGC *gc, - GdkImage *image, - gint xsrc, - gint ysrc, - gint xdest, - gint ydest, - gint width, - gint height); -void gdk_draw_points (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); -void gdk_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs); -void gdk_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); - - - - -/* Selections - */ -gint gdk_selection_owner_set (GdkWindow *owner, - GdkAtom selection, - guint32 time, - gint send_event); -GdkWindow* gdk_selection_owner_get (GdkAtom selection); -void gdk_selection_convert (GdkWindow *requestor, - GdkAtom selection, - GdkAtom target, - guint32 time); -gint gdk_selection_property_get (GdkWindow *requestor, - guchar **data, - GdkAtom *prop_type, - gint *prop_format); -void gdk_selection_send_notify (guint32 requestor, - GdkAtom selection, - GdkAtom target, - GdkAtom property, - guint32 time); - -gint gdk_text_property_to_text_list (GdkAtom encoding, gint format, - guchar *text, gint length, - gchar ***list); -void gdk_free_text_list (gchar **list); -gint gdk_string_to_compound_text (gchar *str, - GdkAtom *encoding, gint *format, - guchar **ctext, gint *length); -void gdk_free_compound_text (guchar *ctext); - -/* Properties - */ -GdkAtom gdk_atom_intern (const gchar *atom_name, - gint only_if_exists); -gchar* gdk_atom_name (GdkAtom atom); -gint gdk_property_get (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format, - gint *actual_length, - guchar **data); - -void gdk_property_change (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - guchar *data, - gint nelements); -void gdk_property_delete (GdkWindow *window, - GdkAtom property); - - /* Rectangle utilities */ gint gdk_rectangle_intersect (GdkRectangle *src1, @@ -827,67 +120,6 @@ void gdk_rectangle_union (GdkRectangle *src1, GdkRectangle *src2, GdkRectangle *dest); -/* XInput support - */ - -void gdk_input_init (void); -void gdk_input_exit (void); -GList *gdk_input_list_devices (void); -void gdk_input_set_extension_events (GdkWindow *window, - gint mask, - GdkExtensionMode mode); -void gdk_input_set_source (guint32 deviceid, - GdkInputSource source); -gint gdk_input_set_mode (guint32 deviceid, - GdkInputMode mode); -void gdk_input_set_axes (guint32 deviceid, - GdkAxisUse *axes); -void gdk_input_set_key (guint32 deviceid, - guint index, - guint keyval, - GdkModifierType modifiers); -void gdk_input_window_get_pointer (GdkWindow *window, - guint32 deviceid, - gdouble *x, - gdouble *y, - gdouble *pressure, - gdouble *xtilt, - gdouble *ytilt, - GdkModifierType *mask); - -GdkTimeCoord *gdk_input_motion_events (GdkWindow *window, - guint32 deviceid, - guint32 start, - guint32 stop, - gint *nevents_return); - -/* International Input Method Support Functions - */ - -gint gdk_im_ready (void); - -void gdk_im_begin (GdkIC *ic, - GdkWindow *window); -void gdk_im_end (void); -GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style); -GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style); - -GdkIC* gdk_ic_new (GdkICAttr *attr, - GdkICAttributesType mask); -void gdk_ic_destroy (GdkIC *ic); -GdkIMStyle gdk_ic_get_style (GdkIC *ic); -GdkEventMask gdk_ic_get_events (GdkIC *ic); - -GdkICAttr* gdk_ic_attr_new (void); -void gdk_ic_attr_destroy (GdkICAttr *attr); - -GdkICAttributesType gdk_ic_set_attr (GdkIC *ic, - GdkICAttr *attr, - GdkICAttributesType mask); -GdkICAttributesType gdk_ic_get_attr (GdkIC *ic, - GdkICAttr *attr, - GdkICAttributesType mask); - /* Conversion functions between wide char and multibyte strings. */ gchar *gdk_wcstombs (const GdkWChar *src); @@ -895,101 +127,6 @@ gint gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max); - -/* Color Context */ - -GdkColorContext *gdk_color_context_new (GdkVisual *visual, - GdkColormap *colormap); - -GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual, - GdkColormap *colormap); - -void gdk_color_context_free (GdkColorContext *cc); - -gulong gdk_color_context_get_pixel (GdkColorContext *cc, - gushort red, - gushort green, - gushort blue, - gint *failed); -void gdk_color_context_get_pixels (GdkColorContext *cc, - gushort *reds, - gushort *greens, - gushort *blues, - gint ncolors, - gulong *colors, - gint *nallocated); -void gdk_color_context_get_pixels_incremental (GdkColorContext *cc, - gushort *reds, - gushort *greens, - gushort *blues, - gint ncolors, - gint *used, - gulong *colors, - gint *nallocated); - -gint gdk_color_context_query_color (GdkColorContext *cc, - GdkColor *color); -gint gdk_color_context_query_colors (GdkColorContext *cc, - GdkColor *colors, - gint num_colors); - -gint gdk_color_context_add_palette (GdkColorContext *cc, - GdkColor *palette, - gint num_palette); - -void gdk_color_context_init_dither (GdkColorContext *cc); -void gdk_color_context_free_dither (GdkColorContext *cc); - -gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc, - gushort *red, - gushort *green, - gushort *blue, - gint *failed); -guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc, - gint *red, - gint *green, - gint *blue, - gint *failed); -/* Regions - */ - -GdkRegion* gdk_region_new (void); -void gdk_region_destroy (GdkRegion *region); - -void gdk_region_get_clipbox(GdkRegion *region, - GdkRectangle *rectangle); - -gboolean gdk_region_empty (GdkRegion *region); -gboolean gdk_region_equal (GdkRegion *region1, - GdkRegion *region2); -gboolean gdk_region_point_in (GdkRegion *region, - gint x, - gint y); -GdkOverlapType gdk_region_rect_in (GdkRegion *region, - GdkRectangle *rect); - -GdkRegion* gdk_region_polygon (GdkPoint *points, - gint npoints, - GdkFillRule fill_rule); - -void gdk_region_offset (GdkRegion *region, - gint dx, - gint dy); -void gdk_region_shrink (GdkRegion *region, - gint dx, - gint dy); - -GdkRegion* gdk_region_union_with_rect (GdkRegion *region, - GdkRectangle *rect); -GdkRegion* gdk_regions_intersect (GdkRegion *source1, - GdkRegion *source2); -GdkRegion* gdk_regions_union (GdkRegion *source1, - GdkRegion *source2); -GdkRegion* gdk_regions_subtract (GdkRegion *source1, - GdkRegion *source2); -GdkRegion* gdk_regions_xor (GdkRegion *source1, - GdkRegion *source2); - /* Miscellaneous */ void gdk_event_send_clientmessage_toall (GdkEvent *event); gboolean gdk_event_send_client_message (GdkEvent *event, @@ -1026,8 +163,6 @@ void gdk_threads_leave (void); # define GDK_THREADS_LEAVE() #endif /* !G_THREADS_ENABLED */ -#include <gdk/gdkrgb.h> - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gdk/gdkcc.c b/gdk/gdkcc.c index d1d1e754f7..f592fa8e54 100644 --- a/gdk/gdkcc.c +++ b/gdk/gdkcc.c @@ -63,13 +63,21 @@ #include <X11/Xlib.h> #include <stdlib.h> #include <string.h> -#include "gdk.h" -#include "gdkprivate.h" -#include "gdkx.h" +#include "gdkcc.h" +#include "gdkcolor.h" +#include "gdkx.h" #define MAX_IMAGE_COLORS 256 +typedef struct _GdkColorContextPrivate GdkColorContextPrivate; + +struct _GdkColorContextPrivate +{ + GdkColorContext color_context; + Display *xdisplay; + XStandardColormap std_cmap; +}; static guint hash_color (gconstpointer key) diff --git a/gdk/gdkcc.h b/gdk/gdkcc.h new file mode 100644 index 0000000000..5650dffdb6 --- /dev/null +++ b/gdk/gdkcc.h @@ -0,0 +1,149 @@ +#ifndef __GDK_CC_H__ +#define __GDK_CC_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GdkColorContextDither GdkColorContextDither; +typedef struct _GdkColorContext GdkColorContext; + + +/* Color Context modes. + * + * GDK_CC_MODE_UNDEFINED - unknown + * GDK_CC_MODE_BW - default B/W + * GDK_CC_MODE_STD_CMAP - has a standard colormap + * GDK_CC_MODE_TRUE - is a TrueColor/DirectColor visual + * GDK_CC_MODE_MY_GRAY - my grayramp + * GDK_CC_MODE_PALETTE - has a pre-allocated palette + */ + +typedef enum +{ + GDK_CC_MODE_UNDEFINED, + GDK_CC_MODE_BW, + GDK_CC_MODE_STD_CMAP, + GDK_CC_MODE_TRUE, + GDK_CC_MODE_MY_GRAY, + GDK_CC_MODE_PALETTE +} GdkColorContextMode; + +struct _GdkColorContextDither +{ + gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */ + gint fast_err[32][32][32]; /* internal RGB error information */ + gint fast_erg[32][32][32]; + gint fast_erb[32][32][32]; +}; + +struct _GdkColorContext +{ + GdkVisual *visual; + GdkColormap *colormap; + + gint num_colors; /* available no. of colors in colormap */ + gint max_colors; /* maximum no. of colors */ + gint num_allocated; /* no. of allocated colors */ + + GdkColorContextMode mode; + gint need_to_free_colormap; + GdkAtom std_cmap_atom; + + gulong *clut; /* color look-up table */ + GdkColor *cmap; /* colormap */ + + GHashTable *color_hash; /* hash table of allocated colors */ + GdkColor *palette; /* preallocated palette */ + gint num_palette; /* size of palette */ + + GdkColorContextDither *fast_dither; /* fast dither matrix */ + + struct + { + gint red; + gint green; + gint blue; + } shifts; + + struct + { + gulong red; + gulong green; + gulong blue; + } masks; + + struct + { + gint red; + gint green; + gint blue; + } bits; + + gulong max_entry; + + gulong black_pixel; + gulong white_pixel; +}; + +GdkColorContext *gdk_color_context_new (GdkVisual *visual, + GdkColormap *colormap); + +GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual, + GdkColormap *colormap); + +void gdk_color_context_free (GdkColorContext *cc); + +gulong gdk_color_context_get_pixel (GdkColorContext *cc, + gushort red, + gushort green, + gushort blue, + gint *failed); +void gdk_color_context_get_pixels (GdkColorContext *cc, + gushort *reds, + gushort *greens, + gushort *blues, + gint ncolors, + gulong *colors, + gint *nallocated); +void gdk_color_context_get_pixels_incremental (GdkColorContext *cc, + gushort *reds, + gushort *greens, + gushort *blues, + gint ncolors, + gint *used, + gulong *colors, + gint *nallocated); + +gint gdk_color_context_query_color (GdkColorContext *cc, + GdkColor *color); +gint gdk_color_context_query_colors (GdkColorContext *cc, + GdkColor *colors, + gint num_colors); + +gint gdk_color_context_add_palette (GdkColorContext *cc, + GdkColor *palette, + gint num_palette); + +void gdk_color_context_init_dither (GdkColorContext *cc); +void gdk_color_context_free_dither (GdkColorContext *cc); + +gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc, + gushort *red, + gushort *green, + gushort *blue, + gint *failed); +guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc, + gint *red, + gint *green, + gint *blue, + gint *failed); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_CC_H__ */ diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index 2baa200ee0..03222cc3d6 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -26,9 +26,9 @@ #include <time.h> #include <X11/Xlib.h> -#include "gdk.h" + +#include "gdkcolor.h" #include "gdkprivate.h" -#include "gdkx.h" static gint gdk_colormap_match_color (GdkColormap *cmap, diff --git a/gdk/gdkcolor.h b/gdk/gdkcolor.h new file mode 100644 index 0000000000..94630f0980 --- /dev/null +++ b/gdk/gdkcolor.h @@ -0,0 +1,99 @@ +#ifndef __GDK_COLOR_H__ +#define __GDK_COLOR_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* The color type. + * A color consists of red, green and blue values in the + * range 0-65535 and a pixel value. The pixel value is highly + * dependent on the depth and colormap which this color will + * be used to draw into. Therefore, sharing colors between + * colormaps is a bad idea. + */ +struct _GdkColor +{ + gulong pixel; + gushort red; + gushort green; + gushort blue; +}; + +/* The colormap type. + */ +struct _GdkColormap +{ + gint size; + GdkColor *colors; +}; + + +GdkColormap* gdk_colormap_new (GdkVisual *visual, + gint allocate); +GdkColormap* gdk_colormap_ref (GdkColormap *cmap); +void gdk_colormap_unref (GdkColormap *cmap); + +GdkColormap* gdk_colormap_get_system (void); +gint gdk_colormap_get_system_size (void); + +void gdk_colormap_change (GdkColormap *colormap, + gint ncolors); + + +gint gdk_colormap_alloc_colors (GdkColormap *colormap, + GdkColor *colors, + gint ncolors, + gboolean writeable, + gboolean best_match, + gboolean *success); +gboolean gdk_colormap_alloc_color (GdkColormap *colormap, + GdkColor *color, + gboolean writeable, + gboolean best_match); +void gdk_colormap_free_colors (GdkColormap *colormap, + GdkColor *colors, + gint ncolors); + +GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap); + +GdkColor *gdk_color_copy (GdkColor *color); +void gdk_color_free (GdkColor *color); + +gint gdk_color_parse (const gchar *spec, + GdkColor *color); +guint gdk_color_hash (const GdkColor *colora); +gint gdk_color_equal (const GdkColor *colora, + const GdkColor *colorb); + + +/* The following functions are deprecated */ +void gdk_colors_store (GdkColormap *colormap, + GdkColor *colors, + gint ncolors); +gint gdk_colors_alloc (GdkColormap *colormap, + gint contiguous, + gulong *planes, + gint nplanes, + gulong *pixels, + gint npixels); +void gdk_colors_free (GdkColormap *colormap, + gulong *pixels, + gint npixels, + gulong planes); +gint gdk_color_white (GdkColormap *colormap, + GdkColor *color); +gint gdk_color_black (GdkColormap *colormap, + GdkColor *color); +gint gdk_color_alloc (GdkColormap *colormap, + GdkColor *color); +gint gdk_color_change (GdkColormap *colormap, + GdkColor *color); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_COLOR_H__ */ diff --git a/gdk/gdkconfig.h b/gdk/gdkconfig.h new file mode 100644 index 0000000000..67c1a71911 --- /dev/null +++ b/gdk/gdkconfig.h @@ -0,0 +1,23 @@ +/* gdkconfig.h + * + * This is a generated file. Please modify `configure.in' + */ + +#ifndef GDKCONFIG_H +#define GDKCONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GDK_WINDOWING_X11 + +#define GDK_HAVE_WCHAR_H 1 +#define GDK_HAVE_WCTYPE_H 1 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* GDKCONFIG_H */ diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c index 568c489dd5..6431c780ad 100644 --- a/gdk/gdkcursor.c +++ b/gdk/gdkcursor.c @@ -26,7 +26,8 @@ #include <X11/Xlib.h> #include <X11/cursorfont.h> -#include "gdk.h" + +#include "gdkcursor.h" #include "gdkprivate.h" diff --git a/gdk/gdkcursor.h b/gdk/gdkcursor.h new file mode 100644 index 0000000000..14f6e4414d --- /dev/null +++ b/gdk/gdkcursor.h @@ -0,0 +1,39 @@ +#ifndef __GDK_CURSOR_H__ +#define __GDK_CURSOR_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Cursor types. + */ +typedef enum +{ +#include <gdk/gdkcursors.h> + GDK_LAST_CURSOR, + GDK_CURSOR_IS_PIXMAP = -1 +} GdkCursorType; + +struct _GdkCursor +{ + GdkCursorType type; +}; + +/* Cursors + */ +GdkCursor* gdk_cursor_new (GdkCursorType cursor_type); +GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source, + GdkPixmap *mask, + GdkColor *fg, + GdkColor *bg, + gint x, + gint y); +void gdk_cursor_destroy (GdkCursor *cursor); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_CURSOR_H__ */ diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c index a2be5e160c..3788229245 100644 --- a/gdk/gdkdnd.c +++ b/gdk/gdkdnd.c @@ -27,9 +27,12 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <string.h> + +#include "gdk.h" /* For gdk_flush() */ +#include "gdkdnd.h" +#include "gdkproperty.h" +#include "gdkprivate.h" #include "gdkx.h" -#include "gdk/gdkprivate.h" -#include "gdk.h" typedef struct _GdkDragContextPrivate GdkDragContextPrivate; diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h new file mode 100644 index 0000000000..3a749fb96e --- /dev/null +++ b/gdk/gdkdnd.h @@ -0,0 +1,100 @@ +#ifndef __GDK_DND_H__ +#define __GDK_DND_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GdkDragContext GdkDragContext; + +typedef enum { + GDK_ACTION_DEFAULT = 1 << 0, + GDK_ACTION_COPY = 1 << 1, + GDK_ACTION_MOVE = 1 << 2, + GDK_ACTION_LINK = 1 << 3, + GDK_ACTION_PRIVATE = 1 << 4, + GDK_ACTION_ASK = 1 << 5 +} GdkDragAction; + +typedef enum { + GDK_DRAG_PROTO_MOTIF, + GDK_DRAG_PROTO_XDND, + GDK_DRAG_PROTO_ROOTWIN, /* A root window with nobody claiming + * drags */ + GDK_DRAG_PROTO_NONE, /* Not a valid drag window */ + GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */ + GDK_DRAG_PROTO_OLE2, /* The complex OLE2 dnd (not implemented) */ +} GdkDragProtocol; + +/* Structure that holds information about a drag in progress. + * this is used on both source and destination sides. + */ +struct _GdkDragContext { + GdkDragProtocol protocol; + + gboolean is_source; + + GdkWindow *source_window; + GdkWindow *dest_window; + + GList *targets; + GdkDragAction actions; + GdkDragAction suggested_action; + GdkDragAction action; + + guint32 start_time; +}; + +/* Drag and Drop */ + +GdkDragContext * gdk_drag_context_new (void); +void gdk_drag_context_ref (GdkDragContext *context); +void gdk_drag_context_unref (GdkDragContext *context); + +/* Destination side */ + +void gdk_drag_status (GdkDragContext *context, + GdkDragAction action, + guint32 time); +void gdk_drop_reply (GdkDragContext *context, + gboolean ok, + guint32 time); +void gdk_drop_finish (GdkDragContext *context, + gboolean success, + guint32 time); +GdkAtom gdk_drag_get_selection (GdkDragContext *context); + +/* Source side */ + +GdkDragContext * gdk_drag_begin (GdkWindow *window, + GList *targets); +guint32 gdk_drag_get_protocol (guint32 xid, + GdkDragProtocol *protocol); +void gdk_drag_find_window (GdkDragContext *context, + GdkWindow *drag_window, + gint x_root, + gint y_root, + GdkWindow **dest_window, + GdkDragProtocol *protocol); +gboolean gdk_drag_motion (GdkDragContext *context, + GdkWindow *dest_window, + GdkDragProtocol protocol, + gint x_root, + gint y_root, + GdkDragAction suggested_action, + GdkDragAction possible_actions, + guint32 time); +void gdk_drag_drop (GdkDragContext *context, + guint32 time); +void gdk_drag_abort (GdkDragContext *context, + guint32 time); + +GdkAtom gdk_drag_get_selection (GdkDragContext *context); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif __GDK_DND_H__ diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 8ae417e4aa..3583649fbe 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -26,9 +26,9 @@ #include <X11/Xlib.h> #include <X11/Xos.h> -#include "gdk.h" -#include "gdkprivate.h" +#include "gdkdrawable.h" +#include "gdkprivate.h" void gdk_draw_point (GdkDrawable *drawable, diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h new file mode 100644 index 0000000000..d4fd6eeb49 --- /dev/null +++ b/gdk/gdkdrawable.h @@ -0,0 +1,143 @@ +#ifndef __GDK_DRAWABLE_H__ +#define __GDK_DRAWABLE_H__ + +#include <gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Types of windows. + * Root: There is only 1 root window and it is initialized + * at startup. Creating a window of type GDK_WINDOW_ROOT + * is an error. + * Toplevel: Windows which interact with the window manager. + * Child: Windows which are children of some other type of window. + * (Any other type of window). Most windows are child windows. + * Dialog: A special kind of toplevel window which interacts with + * the window manager slightly differently than a regular + * toplevel window. Dialog windows should be used for any + * transient window. + * Pixmap: Pixmaps are really just another kind of window which + * doesn't actually appear on the screen. It can't have + * children, either and is really just a convenience so + * that the drawing functions can work on both windows + * and pixmaps transparently. (ie. You shouldn't pass a + * pixmap to any procedure which accepts a window with the + * exception of the drawing functions). + * Foreign: A window that actually belongs to another application + */ +typedef enum +{ + GDK_WINDOW_ROOT, + GDK_WINDOW_TOPLEVEL, + GDK_WINDOW_CHILD, + GDK_WINDOW_DIALOG, + GDK_WINDOW_TEMP, + GDK_WINDOW_PIXMAP, + GDK_WINDOW_FOREIGN +} GdkWindowType; + +struct _GdkWindow +{ + gpointer user_data; +}; + +/* Drawing + */ +void gdk_draw_point (GdkDrawable *drawable, + GdkGC *gc, + gint x, + gint y); +void gdk_draw_line (GdkDrawable *drawable, + GdkGC *gc, + gint x1, + gint y1, + gint x2, + gint y2); +void gdk_draw_rectangle (GdkDrawable *drawable, + GdkGC *gc, + gint filled, + gint x, + gint y, + gint width, + gint height); +void gdk_draw_arc (GdkDrawable *drawable, + GdkGC *gc, + gint filled, + gint x, + gint y, + gint width, + gint height, + gint angle1, + gint angle2); +void gdk_draw_polygon (GdkDrawable *drawable, + GdkGC *gc, + gint filled, + GdkPoint *points, + gint npoints); +void gdk_draw_string (GdkDrawable *drawable, + GdkFont *font, + GdkGC *gc, + gint x, + gint y, + const gchar *string); +void gdk_draw_text (GdkDrawable *drawable, + GdkFont *font, + GdkGC *gc, + gint x, + gint y, + const gchar *text, + gint text_length); +void gdk_draw_text_wc (GdkDrawable *drawable, + GdkFont *font, + GdkGC *gc, + gint x, + gint y, + const GdkWChar *text, + gint text_length); +void gdk_draw_pixmap (GdkDrawable *drawable, + GdkGC *gc, + GdkDrawable *src, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height); +void gdk_draw_bitmap (GdkDrawable *drawable, + GdkGC *gc, + GdkDrawable *src, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height); +void gdk_draw_image (GdkDrawable *drawable, + GdkGC *gc, + GdkImage *image, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height); +void gdk_draw_points (GdkDrawable *drawable, + GdkGC *gc, + GdkPoint *points, + gint npoints); +void gdk_draw_segments (GdkDrawable *drawable, + GdkGC *gc, + GdkSegment *segs, + gint nsegs); +void gdk_draw_lines (GdkDrawable *drawable, + GdkGC *gc, + GdkPoint *points, + gint npoints); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_DRAWABLE_H__ */ diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 4f6f577f29..2adc09cb45 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -25,8 +25,9 @@ */ #include "gdk.h" -#include "gdkx.h" #include "gdkprivate.h" +#include "gdkx.h" + #include "gdkkeysyms.h" #if HAVE_CONFIG_H @@ -36,7 +37,7 @@ # endif #endif -#include "gdkinput.h" +#include "gdkinputprivate.h" typedef struct _GdkIOClosure GdkIOClosure; typedef struct _GdkEventPrivate GdkEventPrivate; diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h new file mode 100644 index 0000000000..607ca82711 --- /dev/null +++ b/gdk/gdkevents.h @@ -0,0 +1,406 @@ +#ifndef __GDK_EVENTS_H__ +#define __GDK_EVENTS_H__ + +#include <gdk/gdktypes.h> +#include <gdk/gdkdnd.h> +#include <gdk/gdkinput.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT) + +typedef struct _GdkEventAny GdkEventAny; +typedef struct _GdkEventExpose GdkEventExpose; +typedef struct _GdkEventNoExpose GdkEventNoExpose; +typedef struct _GdkEventVisibility GdkEventVisibility; +typedef struct _GdkEventMotion GdkEventMotion; +typedef struct _GdkEventButton GdkEventButton; +typedef struct _GdkEventKey GdkEventKey; +typedef struct _GdkEventFocus GdkEventFocus; +typedef struct _GdkEventCrossing GdkEventCrossing; +typedef struct _GdkEventConfigure GdkEventConfigure; +typedef struct _GdkEventProperty GdkEventProperty; +typedef struct _GdkEventSelection GdkEventSelection; +typedef struct _GdkEventProximity GdkEventProximity; +typedef struct _GdkEventClient GdkEventClient; + +typedef struct _GdkEventDND GdkEventDND; + +typedef union _GdkEvent GdkEvent; + +typedef void (*GdkEventFunc) (GdkEvent *event, + gpointer data); + +/* Event filtering */ + +typedef void GdkXEvent; /* Can be cast to XEvent */ + +typedef enum { + GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */ + GDK_FILTER_TRANSLATE, /* Translated event stored */ + GDK_FILTER_REMOVE /* Terminate processing, removing event */ +} GdkFilterReturn; + +typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent, + GdkEvent *event, + gpointer data); + + +/* Event types. + * Nothing: No event occurred. + * Delete: A window delete event was sent by the window manager. + * The specified window should be deleted. + * Destroy: A window has been destroyed. + * Expose: Part of a window has been uncovered. + * NoExpose: Same as expose, but no expose event was generated. + * VisibilityNotify: A window has become fully/partially/not obscured. + * MotionNotify: The mouse has moved. + * ButtonPress: A mouse button was pressed. + * ButtonRelease: A mouse button was release. + * KeyPress: A key was pressed. + * KeyRelease: A key was released. + * EnterNotify: A window was entered. + * LeaveNotify: A window was exited. + * FocusChange: The focus window has changed. (The focus window gets + * keyboard events). + * Resize: A window has been resized. + * Map: A window has been mapped. (It is now visible on the screen). + * Unmap: A window has been unmapped. (It is no longer visible on + * the screen). + */ +typedef enum +{ + GDK_NOTHING = -1, + GDK_DELETE = 0, + GDK_DESTROY = 1, + GDK_EXPOSE = 2, + GDK_MOTION_NOTIFY = 3, + GDK_BUTTON_PRESS = 4, + GDK_2BUTTON_PRESS = 5, + GDK_3BUTTON_PRESS = 6, + GDK_BUTTON_RELEASE = 7, + GDK_KEY_PRESS = 8, + GDK_KEY_RELEASE = 9, + GDK_ENTER_NOTIFY = 10, + GDK_LEAVE_NOTIFY = 11, + GDK_FOCUS_CHANGE = 12, + GDK_CONFIGURE = 13, + GDK_MAP = 14, + GDK_UNMAP = 15, + GDK_PROPERTY_NOTIFY = 16, + GDK_SELECTION_CLEAR = 17, + GDK_SELECTION_REQUEST = 18, + GDK_SELECTION_NOTIFY = 19, + GDK_PROXIMITY_IN = 20, + GDK_PROXIMITY_OUT = 21, + GDK_DRAG_ENTER = 22, + GDK_DRAG_LEAVE = 23, + GDK_DRAG_MOTION = 24, + GDK_DRAG_STATUS = 25, + GDK_DROP_START = 26, + GDK_DROP_FINISHED = 27, + GDK_CLIENT_EVENT = 28, + GDK_VISIBILITY_NOTIFY = 29, + GDK_NO_EXPOSE = 30 +} GdkEventType; + +/* Event masks. (Used to select what types of events a window + * will receive). + */ +typedef enum +{ + GDK_EXPOSURE_MASK = 1 << 1, + GDK_POINTER_MOTION_MASK = 1 << 2, + GDK_POINTER_MOTION_HINT_MASK = 1 << 3, + GDK_BUTTON_MOTION_MASK = 1 << 4, + GDK_BUTTON1_MOTION_MASK = 1 << 5, + GDK_BUTTON2_MOTION_MASK = 1 << 6, + GDK_BUTTON3_MOTION_MASK = 1 << 7, + GDK_BUTTON_PRESS_MASK = 1 << 8, + GDK_BUTTON_RELEASE_MASK = 1 << 9, + GDK_KEY_PRESS_MASK = 1 << 10, + GDK_KEY_RELEASE_MASK = 1 << 11, + GDK_ENTER_NOTIFY_MASK = 1 << 12, + GDK_LEAVE_NOTIFY_MASK = 1 << 13, + GDK_FOCUS_CHANGE_MASK = 1 << 14, + GDK_STRUCTURE_MASK = 1 << 15, + GDK_PROPERTY_CHANGE_MASK = 1 << 16, + GDK_VISIBILITY_NOTIFY_MASK = 1 << 17, + GDK_PROXIMITY_IN_MASK = 1 << 18, + GDK_PROXIMITY_OUT_MASK = 1 << 19, + GDK_SUBSTRUCTURE_MASK = 1 << 20, + GDK_ALL_EVENTS_MASK = 0x0FFFFF +} GdkEventMask; + +typedef enum { + GDK_VISIBILITY_UNOBSCURED, + GDK_VISIBILITY_PARTIAL, + GDK_VISIBILITY_FULLY_OBSCURED +} GdkVisibilityState; + +/* Types of enter/leave notifications. + * Ancestor: + * Virtual: + * Inferior: + * Nonlinear: + * NonlinearVirtual: + * Unknown: An unknown type of enter/leave event occurred. + */ +typedef enum +{ + GDK_NOTIFY_ANCESTOR = 0, + GDK_NOTIFY_VIRTUAL = 1, + GDK_NOTIFY_INFERIOR = 2, + GDK_NOTIFY_NONLINEAR = 3, + GDK_NOTIFY_NONLINEAR_VIRTUAL = 4, + GDK_NOTIFY_UNKNOWN = 5 +} GdkNotifyType; + +/* Enter/leave event modes. + * NotifyNormal + * NotifyGrab + * NotifyUngrab + */ +typedef enum +{ + GDK_CROSSING_NORMAL, + GDK_CROSSING_GRAB, + GDK_CROSSING_UNGRAB +} GdkCrossingMode; + +typedef enum +{ + GDK_PROPERTY_NEW_VALUE, + GDK_PROPERTY_DELETE +} GdkPropertyState; + +struct _GdkEventAny +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; +}; + +struct _GdkEventExpose +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkRectangle area; + gint count; /* If non-zero, how many more events follow. */ +}; + +struct _GdkEventNoExpose +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + /* XXX: does anyone need the X major_code or minor_code fields? */ +}; + +struct _GdkEventVisibility +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkVisibilityState state; +}; + +struct _GdkEventMotion +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + guint32 time; + gdouble x; + gdouble y; + gdouble pressure; + gdouble xtilt; + gdouble ytilt; + guint state; + gint16 is_hint; + GdkInputSource source; + guint32 deviceid; + gdouble x_root, y_root; +}; + +struct _GdkEventButton +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + guint32 time; + gdouble x; + gdouble y; + gdouble pressure; + gdouble xtilt; + gdouble ytilt; + guint state; + guint button; + GdkInputSource source; + guint32 deviceid; + gdouble x_root, y_root; +}; + +struct _GdkEventKey +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + guint32 time; + guint state; + guint keyval; + gint length; + gchar *string; +}; + +struct _GdkEventCrossing +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkWindow *subwindow; + guint32 time; + gdouble x; + gdouble y; + gdouble x_root; + gdouble y_root; + GdkCrossingMode mode; + GdkNotifyType detail; + gboolean focus; + guint state; +}; + +struct _GdkEventFocus +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + gint16 in; +}; + +struct _GdkEventConfigure +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + gint16 x, y; + gint16 width; + gint16 height; +}; + +struct _GdkEventProperty +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkAtom atom; + guint32 time; + guint state; +}; + +struct _GdkEventSelection +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkAtom selection; + GdkAtom target; + GdkAtom property; + guint32 requestor; + guint32 time; +}; + +/* This event type will be used pretty rarely. It only is important + for XInput aware programs that are drawing their own cursor */ + +struct _GdkEventProximity +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + guint32 time; + GdkInputSource source; + guint32 deviceid; +}; + +struct _GdkEventClient +{ + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkAtom message_type; + gushort data_format; + union { + char b[20]; + short s[10]; + long l[5]; + } data; +}; + +/* Event types for DND */ + +struct _GdkEventDND { + GdkEventType type; + GdkWindow *window; + gint8 send_event; + GdkDragContext *context; + + guint32 time; + gshort x_root, y_root; +}; + +union _GdkEvent +{ + GdkEventType type; + GdkEventAny any; + GdkEventExpose expose; + GdkEventNoExpose no_expose; + GdkEventVisibility visibility; + GdkEventMotion motion; + GdkEventButton button; + GdkEventKey key; + GdkEventCrossing crossing; + GdkEventFocus focus_change; + GdkEventConfigure configure; + GdkEventProperty property; + GdkEventSelection selection; + GdkEventProximity proximity; + GdkEventClient client; + GdkEventDND dnd; +}; + +gboolean gdk_events_pending (void); +GdkEvent* gdk_event_get (void); + +GdkEvent* gdk_event_peek (void); +GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window); +void gdk_event_put (GdkEvent *event); + +GdkEvent* gdk_event_copy (GdkEvent *event); +void gdk_event_free (GdkEvent *event); +guint32 gdk_event_get_time (GdkEvent *event); + +void gdk_event_handler_set (GdkEventFunc func, + gpointer data, + GDestroyNotify notify); + +void gdk_set_show_events (gint show_events); +gint gdk_get_show_events (void); + +/* + * The following function adds a global filter for all client + * messages of type message_type + */ +void gdk_add_client_message_filter (GdkAtom message_type, + GdkFilterFunc func, + gpointer data); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_EVENTS_H__ */ diff --git a/gdk/gdkfont.c b/gdk/gdkfont.c index 096cf8a537..a3a3502fba 100644 --- a/gdk/gdkfont.c +++ b/gdk/gdkfont.c @@ -26,7 +26,7 @@ #include <X11/Xlib.h> #include <X11/Xos.h> -#include "gdk.h" +#include "gdkfont.h" #include "gdkprivate.h" static GHashTable *font_name_hash = NULL; diff --git a/gdk/gdkfont.h b/gdk/gdkfont.h new file mode 100644 index 0000000000..fab92938f0 --- /dev/null +++ b/gdk/gdkfont.h @@ -0,0 +1,90 @@ +#ifndef __GDK_FONT_H__ +#define __GDK_FONT_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Types of font. + * GDK_FONT_FONT: the font is an XFontStruct. + * GDK_FONT_FONTSET: the font is an XFontSet used for I18N. + */ +typedef enum +{ + GDK_FONT_FONT, + GDK_FONT_FONTSET +} GdkFontType; + +struct _GdkFont +{ + GdkFontType type; + gint ascent; + gint descent; +}; + +GdkFont* gdk_font_load (const gchar *font_name); +GdkFont* gdk_fontset_load (gchar *fontset_name); +GdkFont* gdk_font_ref (GdkFont *font); +void gdk_font_unref (GdkFont *font); +gint gdk_font_id (const GdkFont *font); +gint gdk_font_equal (const GdkFont *fonta, + const GdkFont *fontb); + +gint gdk_string_width (GdkFont *font, + const gchar *string); +gint gdk_text_width (GdkFont *font, + const gchar *text, + gint text_length); +gint gdk_text_width_wc (GdkFont *font, + const GdkWChar *text, + gint text_length); +gint gdk_char_width (GdkFont *font, + gchar character); +gint gdk_char_width_wc (GdkFont *font, + GdkWChar character); +gint gdk_string_measure (GdkFont *font, + const gchar *string); +gint gdk_text_measure (GdkFont *font, + const gchar *text, + gint text_length); +gint gdk_char_measure (GdkFont *font, + gchar character); +gint gdk_string_height (GdkFont *font, + const gchar *string); +gint gdk_text_height (GdkFont *font, + const gchar *text, + gint text_length); +gint gdk_char_height (GdkFont *font, + gchar character); + +void gdk_text_extents (GdkFont *font, + const gchar *text, + gint text_length, + gint *lbearing, + gint *rbearing, + gint *width, + gint *ascent, + gint *descent); +void gdk_text_extents_wc (GdkFont *font, + const GdkWChar *text, + gint text_length, + gint *lbearing, + gint *rbearing, + gint *width, + gint *ascent, + gint *descent); +void gdk_string_extents (GdkFont *font, + const gchar *string, + gint *lbearing, + gint *rbearing, + gint *width, + gint *ascent, + gint *descent); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_FONT_H__ */ diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c index 8b6e4fd0ed..b5f57b0ba8 100644 --- a/gdk/gdkgc.c +++ b/gdk/gdkgc.c @@ -26,7 +26,8 @@ #include <string.h> #include <X11/Xlib.h> -#include "gdk.h" + +#include "gdkgc.h" #include "gdkprivate.h" diff --git a/gdk/gdkgc.h b/gdk/gdkgc.h new file mode 100644 index 0000000000..907b7f674f --- /dev/null +++ b/gdk/gdkgc.h @@ -0,0 +1,212 @@ +#ifndef __GDK_GC_H__ +#define __GDK_GC_H__ + +#include <gdk/gdkcolor.h> +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GdkGCValues GdkGCValues; + +/* GC cap styles + * CapNotLast: + * CapButt: + * CapRound: + * CapProjecting: + */ +typedef enum +{ + GDK_CAP_NOT_LAST, + GDK_CAP_BUTT, + GDK_CAP_ROUND, + GDK_CAP_PROJECTING +} GdkCapStyle; + +/* GC fill types. + * Solid: + * Tiled: + * Stippled: + * OpaqueStippled: + */ +typedef enum +{ + GDK_SOLID, + GDK_TILED, + GDK_STIPPLED, + GDK_OPAQUE_STIPPLED +} GdkFill; + +/* GC function types. + * Copy: Overwrites destination pixels with the source pixels. + * Invert: Inverts the destination pixels. + * Xor: Xor's the destination pixels with the source pixels. + * Clear: set pixels to 0 + * And: source AND destination + * And Reverse: source AND (NOT destination) + * And Invert: (NOT source) AND destination + * Noop: destination + * Or: source OR destination + * Nor: (NOT source) AND (NOT destination) + * Equiv: (NOT source) XOR destination + * Xor Reverse: source OR (NOT destination) + * Copy Inverted: NOT source + * Xor Inverted: (NOT source) OR destination + * Nand: (NOT source) OR (NOT destination) + * Set: set pixels to 1 + */ +typedef enum +{ + GDK_COPY, + GDK_INVERT, + GDK_XOR, + GDK_CLEAR, + GDK_AND, + GDK_AND_REVERSE, + GDK_AND_INVERT, + GDK_NOOP, + GDK_OR, + GDK_EQUIV, + GDK_OR_REVERSE, + GDK_COPY_INVERT, + GDK_OR_INVERT, + GDK_NAND, + GDK_SET +} GdkFunction; + +/* GC join styles + * JoinMiter: + * JoinRound: + * JoinBevel: + */ +typedef enum +{ + GDK_JOIN_MITER, + GDK_JOIN_ROUND, + GDK_JOIN_BEVEL +} GdkJoinStyle; + +/* GC line styles + * Solid: + * OnOffDash: + * DoubleDash: + */ +typedef enum +{ + GDK_LINE_SOLID, + GDK_LINE_ON_OFF_DASH, + GDK_LINE_DOUBLE_DASH +} GdkLineStyle; + +typedef enum +{ + GDK_CLIP_BY_CHILDREN = 0, + GDK_INCLUDE_INFERIORS = 1 +} GdkSubwindowMode; + +typedef enum +{ + GDK_GC_FOREGROUND = 1 << 0, + GDK_GC_BACKGROUND = 1 << 1, + GDK_GC_FONT = 1 << 2, + GDK_GC_FUNCTION = 1 << 3, + GDK_GC_FILL = 1 << 4, + GDK_GC_TILE = 1 << 5, + GDK_GC_STIPPLE = 1 << 6, + GDK_GC_CLIP_MASK = 1 << 7, + GDK_GC_SUBWINDOW = 1 << 8, + GDK_GC_TS_X_ORIGIN = 1 << 9, + GDK_GC_TS_Y_ORIGIN = 1 << 10, + GDK_GC_CLIP_X_ORIGIN = 1 << 11, + GDK_GC_CLIP_Y_ORIGIN = 1 << 12, + GDK_GC_EXPOSURES = 1 << 13, + GDK_GC_LINE_WIDTH = 1 << 14, + GDK_GC_LINE_STYLE = 1 << 15, + GDK_GC_CAP_STYLE = 1 << 16, + GDK_GC_JOIN_STYLE = 1 << 17 +} GdkGCValuesMask; + +struct _GdkGCValues +{ + GdkColor foreground; + GdkColor background; + GdkFont *font; + GdkFunction function; + GdkFill fill; + GdkPixmap *tile; + GdkPixmap *stipple; + GdkPixmap *clip_mask; + GdkSubwindowMode subwindow_mode; + gint ts_x_origin; + gint ts_y_origin; + gint clip_x_origin; + gint clip_y_origin; + gint graphics_exposures; + gint line_width; + GdkLineStyle line_style; + GdkCapStyle cap_style; + GdkJoinStyle join_style; +}; + +struct _GdkGC +{ + gint dummy_var; +}; + +GdkGC* gdk_gc_new (GdkWindow *window); +GdkGC* gdk_gc_new_with_values (GdkWindow *window, + GdkGCValues *values, + GdkGCValuesMask values_mask); +GdkGC* gdk_gc_ref (GdkGC *gc); +void gdk_gc_unref (GdkGC *gc); +void gdk_gc_destroy (GdkGC *gc); +void gdk_gc_get_values (GdkGC *gc, + GdkGCValues *values); +void gdk_gc_set_foreground (GdkGC *gc, + GdkColor *color); +void gdk_gc_set_background (GdkGC *gc, + GdkColor *color); +void gdk_gc_set_font (GdkGC *gc, + GdkFont *font); +void gdk_gc_set_function (GdkGC *gc, + GdkFunction function); +void gdk_gc_set_fill (GdkGC *gc, + GdkFill fill); +void gdk_gc_set_tile (GdkGC *gc, + GdkPixmap *tile); +void gdk_gc_set_stipple (GdkGC *gc, + GdkPixmap *stipple); +void gdk_gc_set_ts_origin (GdkGC *gc, + gint x, + gint y); +void gdk_gc_set_clip_origin (GdkGC *gc, + gint x, + gint y); +void gdk_gc_set_clip_mask (GdkGC *gc, + GdkBitmap *mask); +void gdk_gc_set_clip_rectangle (GdkGC *gc, + GdkRectangle *rectangle); +void gdk_gc_set_clip_region (GdkGC *gc, + GdkRegion *region); +void gdk_gc_set_subwindow (GdkGC *gc, + GdkSubwindowMode mode); +void gdk_gc_set_exposures (GdkGC *gc, + gint exposures); +void gdk_gc_set_line_attributes (GdkGC *gc, + gint line_width, + GdkLineStyle line_style, + GdkCapStyle cap_style, + GdkJoinStyle join_style); +void gdk_gc_set_dashes (GdkGC *gc, + gint dash_offset, + gchar dash_list[], + gint n); +void gdk_gc_copy (GdkGC *dst_gc, + GdkGC *src_gc); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_DRAWABLE_H__ */ diff --git a/gdk/gdkim.c b/gdk/gdkim.c index e453925093..020460f329 100644 --- a/gdk/gdkim.c +++ b/gdk/gdkim.c @@ -25,7 +25,10 @@ */ #include <X11/Xlocale.h> -#include "gdk.h" + +#include "gdk.h" /* For gdk_flush() */ +#include "gdkim.h" +#include "gdkpixmap.h" #include "gdkprivate.h" #include "gdki18n.h" #include "gdkx.h" diff --git a/gdk/gdkim.h b/gdk/gdkim.h new file mode 100644 index 0000000000..3f3ceb692c --- /dev/null +++ b/gdk/gdkim.h @@ -0,0 +1,126 @@ +/* International Input Method Support Functions + */ + +#ifndef __GDK_IM_H__ +#define __GDK_IM_H__ + +#include <gdk/gdkcolor.h> +#include <gdk/gdkevents.h> +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GdkIC GdkIC; +typedef struct _GdkICAttr GdkICAttr; + +typedef enum /*< flags >*/ +{ + GDK_IM_PREEDIT_AREA = 0x0001, + GDK_IM_PREEDIT_CALLBACKS = 0x0002, + GDK_IM_PREEDIT_POSITION = 0x0004, + GDK_IM_PREEDIT_NOTHING = 0x0008, + GDK_IM_PREEDIT_NONE = 0x0010, + GDK_IM_PREEDIT_MASK = 0x001f, + + GDK_IM_STATUS_AREA = 0x0100, + GDK_IM_STATUS_CALLBACKS = 0x0200, + GDK_IM_STATUS_NOTHING = 0x0400, + GDK_IM_STATUS_NONE = 0x0800, + GDK_IM_STATUS_MASK = 0x0f00 +} GdkIMStyle; + +typedef enum +{ + GDK_IC_STYLE = 1 << 0, + GDK_IC_CLIENT_WINDOW = 1 << 1, + GDK_IC_FOCUS_WINDOW = 1 << 2, + GDK_IC_FILTER_EVENTS = 1 << 3, + GDK_IC_SPOT_LOCATION = 1 << 4, + GDK_IC_LINE_SPACING = 1 << 5, + GDK_IC_CURSOR = 1 << 6, + + GDK_IC_PREEDIT_FONTSET = 1 << 10, + GDK_IC_PREEDIT_AREA = 1 << 11, + GDK_IC_PREEDIT_AREA_NEEDED = 1 << 12, + GDK_IC_PREEDIT_FOREGROUND = 1 << 13, + GDK_IC_PREEDIT_BACKGROUND = 1 << 14, + GDK_IC_PREEDIT_PIXMAP = 1 << 15, + GDK_IC_PREEDIT_COLORMAP = 1 << 16, + + GDK_IC_STATUS_FONTSET = 1 << 21, + GDK_IC_STATUS_AREA = 1 << 22, + GDK_IC_STATUS_AREA_NEEDED = 1 << 23, + GDK_IC_STATUS_FOREGROUND = 1 << 24, + GDK_IC_STATUS_BACKGROUND = 1 << 25, + GDK_IC_STATUS_PIXMAP = 1 << 26, + GDK_IC_STATUS_COLORMAP = 1 << 27, + + GDK_IC_ALL_REQ = GDK_IC_STYLE | + GDK_IC_CLIENT_WINDOW, + + GDK_IC_PREEDIT_AREA_REQ = GDK_IC_PREEDIT_AREA | + GDK_IC_PREEDIT_FONTSET, + GDK_IC_PREEDIT_POSITION_REQ = GDK_IC_PREEDIT_AREA | GDK_IC_SPOT_LOCATION | + GDK_IC_PREEDIT_FONTSET, + + GDK_IC_STATUS_AREA_REQ = GDK_IC_STATUS_AREA | + GDK_IC_STATUS_FONTSET +} GdkICAttributesType; + +struct _GdkICAttr +{ + GdkIMStyle style; + GdkWindow *client_window; + GdkWindow *focus_window; + GdkEventMask filter_events; + GdkPoint spot_location; + gint line_spacing; + GdkCursor *cursor; + + GdkFont *preedit_fontset; + GdkRectangle preedit_area; + GdkRectangle preedit_area_needed; + GdkColor preedit_foreground; + GdkColor preedit_background; + GdkPixmap *preedit_pixmap; + GdkColormap *preedit_colormap; + + GdkFont *status_fontset; + GdkRectangle status_area; + GdkRectangle status_area_needed; + GdkColor status_foreground; + GdkColor status_background; + GdkPixmap *status_pixmap; + GdkColormap *status_colormap; +}; + +gint gdk_im_ready (void); + +void gdk_im_begin (GdkIC *ic, + GdkWindow *window); +void gdk_im_end (void); +GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style); +GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style); + +GdkIC* gdk_ic_new (GdkICAttr *attr, + GdkICAttributesType mask); +void gdk_ic_destroy (GdkIC *ic); +GdkIMStyle gdk_ic_get_style (GdkIC *ic); +GdkEventMask gdk_ic_get_events (GdkIC *ic); + +GdkICAttr* gdk_ic_attr_new (void); +void gdk_ic_attr_destroy (GdkICAttr *attr); + +GdkICAttributesType gdk_ic_set_attr (GdkIC *ic, + GdkICAttr *attr, + GdkICAttributesType mask); +GdkICAttributesType gdk_ic_get_attr (GdkIC *ic, + GdkICAttr *attr, + GdkICAttributesType mask); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_IM_H__ */ diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c index 7dae0d92ee..769727a4b6 100644 --- a/gdk/gdkimage.c +++ b/gdk/gdkimage.c @@ -53,7 +53,8 @@ #include <X11/extensions/XShm.h> #endif /* USE_SHM */ -#include "gdk.h" +#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */ +#include "gdkimage.h" #include "gdkprivate.h" diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h new file mode 100644 index 0000000000..76550afcbb --- /dev/null +++ b/gdk/gdkimage.h @@ -0,0 +1,79 @@ +#ifndef __GDK_IMAGE_H__ +#define __GDK_IMAGE_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Types of images. + * Normal: Normal X image type. These are slow as they involve passing + * the entire image through the X connection each time a draw + * request is required. On Win32, a bitmap. + * Shared: Shared memory X image type. These are fast as the X server + * and the program actually use the same piece of memory. They + * should be used with care though as there is the possibility + * for both the X server and the program to be reading/writing + * the image simultaneously and producing undesired results. + * On Win32, also a bitmap. + * Shared Pixmap: Also a shared memory image, which also has a + * pixmap using the same memory. Used by gdk_imlib with the + * Win32 backend. + */ +typedef enum +{ + GDK_IMAGE_NORMAL, + GDK_IMAGE_SHARED, + GDK_IMAGE_FASTEST, + GDK_IMAGE_SHARED_PIXMAP +} GdkImageType; + +struct _GdkImage +{ + GdkImageType type; + GdkVisual *visual; /* visual used to create the image */ + GdkByteOrder byte_order; + guint16 width; + guint16 height; + guint16 depth; + guint16 bpp; /* bytes per pixel */ + guint16 bpl; /* bytes per line */ + gpointer mem; +}; + + +GdkImage* gdk_image_new_bitmap(GdkVisual *visual, + gpointer data, + gint width, + gint height); +GdkImage* gdk_image_new (GdkImageType type, + GdkVisual *visual, + gint width, + gint height); +#if GDK_WINDOWING == GDK_WINDOWING_WIN32 +GdkImage* gdk_image_bitmap_new(GdkImageType type, + GdkVisual *visual, + gint width, + gint height); +#endif +GdkImage* gdk_image_get (GdkDrawable *drawable, + gint x, + gint y, + gint width, + gint height); +void gdk_image_put_pixel (GdkImage *image, + gint x, + gint y, + guint32 pixel); +guint32 gdk_image_get_pixel (GdkImage *image, + gint x, + gint y); +void gdk_image_destroy (GdkImage *image); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_IMAGE_H__ */ diff --git a/gdk/gdkinput.c b/gdk/gdkinput.c index b09821ff6e..8f75330067 100644 --- a/gdk/gdkinput.c +++ b/gdk/gdkinput.c @@ -28,11 +28,10 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include "config.h" -#include "gdk.h" -#include "gdkx.h" -#include "gdkprivate.h" -#include "gdkinput.h" +#include "gdkinput.h" +#include "gdkprivate.h" +#include "gdkinputprivate.h" /* Forward declarations */ diff --git a/gdk/gdkinput.h b/gdk/gdkinput.h index a0fd16dc38..c34c677955 100644 --- a/gdk/gdkinput.h +++ b/gdk/gdkinput.h @@ -1,160 +1,109 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - #ifndef __GDK_INPUT_H__ #define __GDK_INPUT_H__ -#ifndef XINPUT_NONE -#include <X11/extensions/XInput.h> -#endif +#include <gdk/gdktypes.h> -typedef struct _GdkAxisInfo GdkAxisInfo; -typedef struct _GdkInputVTable GdkInputVTable; -typedef struct _GdkDevicePrivate GdkDevicePrivate; -typedef struct _GdkInputWindow GdkInputWindow; +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ -struct _GdkInputVTable { - gint (*set_mode) (guint32 deviceid, GdkInputMode mode); - void (*set_axes) (guint32 deviceid, GdkAxisUse *axes); - void (*set_key) (guint32 deviceid, - guint index, - guint keyval, - GdkModifierType modifiers); - - GdkTimeCoord* (*motion_events) (GdkWindow *window, - guint32 deviceid, - guint32 start, - guint32 stop, - gint *nevents_return); - void (*get_pointer) (GdkWindow *window, - guint32 deviceid, - gdouble *x, - gdouble *y, - gdouble *pressure, - gdouble *xtilt, - gdouble *ytilt, - GdkModifierType *mask); - gint (*grab_pointer) (GdkWindow * window, - gint owner_events, - GdkEventMask event_mask, - GdkWindow * confine_to, - guint32 time); - void (*ungrab_pointer) (guint32 time); +typedef struct _GdkDeviceKey GdkDeviceKey; +typedef struct _GdkDeviceInfo GdkDeviceInfo; +typedef struct _GdkTimeCoord GdkTimeCoord; - void (*configure_event) (XConfigureEvent *xevent, GdkWindow *window); - void (*enter_event) (XCrossingEvent *xevent, GdkWindow *window); - gint (*other_event) (GdkEvent *event, XEvent *xevent, GdkWindow *window); - /* Handle an unidentified event. Returns TRUE if handled, FALSE - otherwise */ - gint (*window_none_event) (GdkEvent *event, XEvent *xevent); - gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev); - gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev); -}; +typedef enum +{ + GDK_EXTENSION_EVENTS_NONE, + GDK_EXTENSION_EVENTS_ALL, + GDK_EXTENSION_EVENTS_CURSOR +} GdkExtensionMode; -/* information about a device axis */ -struct _GdkAxisInfo +typedef enum { - /* reported x resolution */ - gint xresolution; + GDK_SOURCE_MOUSE, + GDK_SOURCE_PEN, + GDK_SOURCE_ERASER, + GDK_SOURCE_CURSOR +} GdkInputSource; - /* reported x minimum/maximum values */ - gint xmin_value, xmax_value; +typedef enum +{ + GDK_MODE_DISABLED, + GDK_MODE_SCREEN, + GDK_MODE_WINDOW +} GdkInputMode; - /* calibrated resolution (for aspect ration) - only relative values - between axes used */ - gint resolution; - - /* calibrated minimum/maximum values */ - gint min_value, max_value; +typedef enum +{ + GDK_AXIS_IGNORE, + GDK_AXIS_X, + GDK_AXIS_Y, + GDK_AXIS_PRESSURE, + GDK_AXIS_XTILT, + GDK_AXIS_YTILT, + GDK_AXIS_LAST +} GdkAxisUse; + +struct _GdkDeviceInfo +{ + guint32 deviceid; + gchar *name; + GdkInputSource source; + GdkInputMode mode; + gint has_cursor; /* TRUE if the X pointer follows device motion */ + gint num_axes; + GdkAxisUse *axes; /* Specifies use for each axis */ + gint num_keys; + GdkDeviceKey *keys; }; -#define GDK_INPUT_NUM_EVENTC 6 - -struct _GdkDevicePrivate { - GdkDeviceInfo info; - -#ifndef XINPUT_NONE - /* information about the axes */ - GdkAxisInfo *axes; - - /* reverse lookup on axis use type */ - gint axis_for_use[GDK_AXIS_LAST]; - - /* Information about XInput device */ - XDevice *xdevice; - - /* minimum key code for device */ - gint min_keycode; - - int buttonpress_type, buttonrelease_type, keypress_type, - keyrelease_type, motionnotify_type, proximityin_type, - proximityout_type, changenotify_type; - - /* true if we need to select a different set of events, but - can't because this is the core pointer */ - gint needs_update; - - /* Mask of buttons (used for button grabs) */ - gint button_state; - - /* true if we've claimed the device as active. (used only for XINPUT_GXI) */ - gint claimed; -#endif /* !XINPUT_NONE */ +struct _GdkDeviceKey +{ + guint keyval; + GdkModifierType modifiers; }; -struct _GdkInputWindow +struct _GdkTimeCoord { - /* gdk window */ - GdkWindow *window; - - /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */ - GdkExtensionMode mode; - - /* position relative to root window */ - gint16 root_x; - gint16 root_y; - - /* rectangles relative to window of windows obscuring this one */ - GdkRectangle *obscuring; - gint num_obscuring; - - /* Is there a pointer grab for this window ? */ - gint grabbed; + guint32 time; + gdouble x; + gdouble y; + gdouble pressure; + gdouble xtilt; + gdouble ytilt; }; -/* Global data */ - -extern GdkInputVTable gdk_input_vtable; -/* information about network port and host for gxid daemon */ -extern gchar *gdk_input_gxid_host; -extern gint gdk_input_gxid_port; -extern gint gdk_input_ignore_core; - -/* Function declarations */ - -void gdk_input_window_destroy (GdkWindow *window); +GList *gdk_input_list_devices (void); +void gdk_input_set_extension_events (GdkWindow *window, + gint mask, + GdkExtensionMode mode); +void gdk_input_set_source (guint32 deviceid, + GdkInputSource source); +gint gdk_input_set_mode (guint32 deviceid, + GdkInputMode mode); +void gdk_input_set_axes (guint32 deviceid, + GdkAxisUse *axes); +void gdk_input_set_key (guint32 deviceid, + guint index, + guint keyval, + GdkModifierType modifiers); +void gdk_input_window_get_pointer (GdkWindow *window, + guint32 deviceid, + gdouble *x, + gdouble *y, + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, + GdkModifierType *mask); + +GdkTimeCoord *gdk_input_motion_events (GdkWindow *window, + guint32 deviceid, + guint32 start, + guint32 stop, + gint *nevents_return); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* __GDK_INPUT_H__ */ diff --git a/gdk/gdkinputprivate.h b/gdk/gdkinputprivate.h new file mode 100644 index 0000000000..0f41c462b4 --- /dev/null +++ b/gdk/gdkinputprivate.h @@ -0,0 +1,162 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GDK_INPUTPRIVATE_H__ +#define __GDK_INPUTPRIVATE_H__ + +#ifndef XINPUT_NONE +#include <X11/extensions/XInput.h> +#endif + +typedef struct _GdkAxisInfo GdkAxisInfo; +typedef struct _GdkInputVTable GdkInputVTable; +typedef struct _GdkDevicePrivate GdkDevicePrivate; +typedef struct _GdkInputWindow GdkInputWindow; + +struct _GdkInputVTable { + gint (*set_mode) (guint32 deviceid, GdkInputMode mode); + void (*set_axes) (guint32 deviceid, GdkAxisUse *axes); + void (*set_key) (guint32 deviceid, + guint index, + guint keyval, + GdkModifierType modifiers); + + GdkTimeCoord* (*motion_events) (GdkWindow *window, + guint32 deviceid, + guint32 start, + guint32 stop, + gint *nevents_return); + void (*get_pointer) (GdkWindow *window, + guint32 deviceid, + gdouble *x, + gdouble *y, + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, + GdkModifierType *mask); + gint (*grab_pointer) (GdkWindow * window, + gint owner_events, + GdkEventMask event_mask, + GdkWindow * confine_to, + guint32 time); + void (*ungrab_pointer) (guint32 time); + + void (*configure_event) (XConfigureEvent *xevent, GdkWindow *window); + void (*enter_event) (XCrossingEvent *xevent, GdkWindow *window); + gint (*other_event) (GdkEvent *event, XEvent *xevent, GdkWindow *window); + /* Handle an unidentified event. Returns TRUE if handled, FALSE + otherwise */ + gint (*window_none_event) (GdkEvent *event, XEvent *xevent); + gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev); + gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev); +}; + +/* information about a device axis */ +struct _GdkAxisInfo +{ + /* reported x resolution */ + gint xresolution; + + /* reported x minimum/maximum values */ + gint xmin_value, xmax_value; + + /* calibrated resolution (for aspect ration) - only relative values + between axes used */ + gint resolution; + + /* calibrated minimum/maximum values */ + gint min_value, max_value; +}; + +#define GDK_INPUT_NUM_EVENTC 6 + +struct _GdkDevicePrivate { + GdkDeviceInfo info; + +#ifndef XINPUT_NONE + /* information about the axes */ + GdkAxisInfo *axes; + + /* reverse lookup on axis use type */ + gint axis_for_use[GDK_AXIS_LAST]; + + /* Information about XInput device */ + XDevice *xdevice; + + /* minimum key code for device */ + gint min_keycode; + + int buttonpress_type, buttonrelease_type, keypress_type, + keyrelease_type, motionnotify_type, proximityin_type, + proximityout_type, changenotify_type; + + /* true if we need to select a different set of events, but + can't because this is the core pointer */ + gint needs_update; + + /* Mask of buttons (used for button grabs) */ + gint button_state; + + /* true if we've claimed the device as active. (used only for XINPUT_GXI) */ + gint claimed; +#endif /* !XINPUT_NONE */ +}; + +struct _GdkInputWindow +{ + /* gdk window */ + GdkWindow *window; + + /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */ + GdkExtensionMode mode; + + /* position relative to root window */ + gint16 root_x; + gint16 root_y; + + /* rectangles relative to window of windows obscuring this one */ + GdkRectangle *obscuring; + gint num_obscuring; + + /* Is there a pointer grab for this window ? */ + gint grabbed; +}; + +/* Global data */ + +extern GdkInputVTable gdk_input_vtable; +/* information about network port and host for gxid daemon */ +extern gchar *gdk_input_gxid_host; +extern gint gdk_input_gxid_port; +extern gint gdk_input_ignore_core; + +/* Function declarations */ + +void gdk_input_window_destroy (GdkWindow *window); +void gdk_input_init (void); +void gdk_input_exit (void); + +#endif /* __GDK_INPUTPRIVATE_H__ */ diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 6fc47e316e..5656b18a93 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -32,7 +32,7 @@ #include <unistd.h> #include <X11/Xlib.h> -#include "gdk.h" +#include "gdkpixmap.h" #include "gdkprivate.h" typedef struct diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h new file mode 100644 index 0000000000..bd2dea588f --- /dev/null +++ b/gdk/gdkpixmap.h @@ -0,0 +1,67 @@ +#ifndef __GDK_PIXMAP_H__ +#define __GDK_PIXMAP_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Pixmaps + */ +GdkPixmap* gdk_pixmap_new (GdkWindow *window, + gint width, + gint height, + gint depth); +#if GDK_WINDOWING == GDK_WINDOWING_WIN32 +GdkPixmap* gdk_pixmap_create_on_shared_image + (GdkImage **image_return, + GdkWindow *window, + GdkVisual *visual, + gint width, + gint height, + gint depth); +#endif +GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window, + const gchar *data, + gint width, + gint height); +GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window, + const gchar *data, + gint width, + gint height, + gint depth, + GdkColor *fg, + GdkColor *bg); +GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window, + GdkBitmap **mask, + GdkColor *transparent_color, + const gchar *filename); +GdkPixmap* gdk_pixmap_colormap_create_from_xpm + (GdkWindow *window, + GdkColormap *colormap, + GdkBitmap **mask, + GdkColor *transparent_color, + const gchar *filename); +GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window, + GdkBitmap **mask, + GdkColor *transparent_color, + gchar **data); +GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d + (GdkWindow *window, + GdkColormap *colormap, + GdkBitmap **mask, + GdkColor *transparent_color, + gchar **data); +GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap); +void gdk_pixmap_unref (GdkPixmap *pixmap); + +GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap); +void gdk_bitmap_unref (GdkBitmap *pixmap); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_PIXMAP_H__ */ diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h index b549211858..091ca44011 100644 --- a/gdk/gdkprivate.h +++ b/gdk/gdkprivate.h @@ -30,8 +30,19 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> + #include <gdk/gdktypes.h> +#include <gdk/gdkcursor.h> +#include <gdk/gdkevents.h> +#include <gdk/gdkfont.h> +#include <gdk/gdkgc.h> +#include <gdk/gdkim.h> +#include <gdk/gdkimage.h> +#include <gdk/gdkregion.h> +#include <gdk/gdkvisual.h> +#include <gdk/gdkwindow.h> + #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid)) #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid)) #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid)) @@ -53,7 +64,6 @@ typedef struct _GdkFontPrivate GdkFontPrivate; typedef struct _GdkCursorPrivate GdkCursorPrivate; typedef struct _GdkEventFilter GdkEventFilter; typedef struct _GdkClientFilter GdkClientFilter; -typedef struct _GdkColorContextPrivate GdkColorContextPrivate; typedef struct _GdkRegionPrivate GdkRegionPrivate; @@ -209,13 +219,6 @@ struct _GdkICPrivate #endif /* USE_XIM */ -struct _GdkColorContextPrivate -{ - GdkColorContext color_context; - Display *xdisplay; - XStandardColormap std_cmap; -}; - struct _GdkRegionPrivate { GdkRegion region; diff --git a/gdk/gdkproperty.c b/gdk/gdkproperty.c index 7973d8fc7e..5a17abd769 100644 --- a/gdk/gdkproperty.c +++ b/gdk/gdkproperty.c @@ -27,7 +27,8 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <string.h> -#include "gdk.h" + +#include "gdkproperty.h" #include "gdkprivate.h" GdkAtom diff --git a/gdk/gdkproperty.h b/gdk/gdkproperty.h new file mode 100644 index 0000000000..331191c487 --- /dev/null +++ b/gdk/gdkproperty.h @@ -0,0 +1,54 @@ +#ifndef __GDK_PROPERTY_H__ +#define __GDK_PROPERTY_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef enum +{ + GDK_PROP_MODE_REPLACE, + GDK_PROP_MODE_PREPEND, + GDK_PROP_MODE_APPEND +} GdkPropMode; + +GdkAtom gdk_atom_intern (const gchar *atom_name, + gint only_if_exists); +gchar* gdk_atom_name (GdkAtom atom); +gboolean gdk_property_get (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gulong offset, + gulong length, + gint pdelete, + GdkAtom *actual_property_type, + gint *actual_format, + gint *actual_length, + guchar **data); + +void gdk_property_change (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gint format, + GdkPropMode mode, + guchar *data, + gint nelements); +void gdk_property_delete (GdkWindow *window, + GdkAtom property); + +gint gdk_text_property_to_text_list (GdkAtom encoding, gint format, + guchar *text, gint length, + gchar ***list); +void gdk_free_text_list (gchar **list); +gint gdk_string_to_compound_text (gchar *str, + GdkAtom *encoding, gint *format, + guchar **ctext, gint *length); +void gdk_free_compound_text (guchar *ctext); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_PROPERTY_H__ */ diff --git a/gdk/gdkrectangle.c b/gdk/gdkrectangle.c index 3eeb540ff8..381ccd5f7b 100644 --- a/gdk/gdkrectangle.c +++ b/gdk/gdkrectangle.c @@ -26,8 +26,6 @@ #include <gdk/gdk.h> - - void gdk_rectangle_union (GdkRectangle *src1, GdkRectangle *src2, diff --git a/gdk/gdkregion.h b/gdk/gdkregion.h new file mode 100644 index 0000000000..c52b702bad --- /dev/null +++ b/gdk/gdkregion.h @@ -0,0 +1,79 @@ +#ifndef __GDK_REGION_H__ +#define __GDK_REGION_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* GC fill rule for polygons + * EvenOddRule + * WindingRule + */ +typedef enum +{ + GDK_EVEN_ODD_RULE, + GDK_WINDING_RULE +} GdkFillRule; + +/* Types of overlapping between a rectangle and a region + * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region + * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region + * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region + */ +typedef enum +{ + GDK_OVERLAP_RECTANGLE_IN, + GDK_OVERLAP_RECTANGLE_OUT, + GDK_OVERLAP_RECTANGLE_PART +} GdkOverlapType; + +struct _GdkRegion +{ + gpointer user_data; +}; + +GdkRegion* gdk_region_new (void); +void gdk_region_destroy (GdkRegion *region); + +void gdk_region_get_clipbox(GdkRegion *region, + GdkRectangle *rectangle); + +gboolean gdk_region_empty (GdkRegion *region); +gboolean gdk_region_equal (GdkRegion *region1, + GdkRegion *region2); +gboolean gdk_region_point_in (GdkRegion *region, + int x, + int y); +GdkOverlapType gdk_region_rect_in (GdkRegion *region, + GdkRectangle *rect); + +GdkRegion* gdk_region_polygon (GdkPoint *points, + gint npoints, + GdkFillRule fill_rule); + +void gdk_region_offset (GdkRegion *region, + gint dx, + gint dy); +void gdk_region_shrink (GdkRegion *region, + gint dx, + gint dy); + +GdkRegion* gdk_region_union_with_rect (GdkRegion *region, + GdkRectangle *rect); +GdkRegion* gdk_regions_intersect (GdkRegion *source1, + GdkRegion *source2); +GdkRegion* gdk_regions_union (GdkRegion *source1, + GdkRegion *source2); +GdkRegion* gdk_regions_subtract (GdkRegion *source1, + GdkRegion *source2); +GdkRegion* gdk_regions_xor (GdkRegion *source1, + GdkRegion *source2); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_REGION_H__ */ diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c index e72d8da167..806e93dee7 100644 --- a/gdk/gdkrgb.c +++ b/gdk/gdkrgb.c @@ -57,12 +57,12 @@ /* Compiling as a part of Gtk 1.1 or later */ #include "config.h" -#include <gdk/gdk.h> #include "gdkprivate.h" #endif -#include <gdk/gdkrgb.h> +#include "gdk.h" /* For gdk_flush() */ +#include "gdkrgb.h" typedef struct _GdkRgbInfo GdkRgbInfo; diff --git a/gdk/gdkrgb.h b/gdk/gdkrgb.h index f3e47939e6..a1f9b25e71 100644 --- a/gdk/gdkrgb.h +++ b/gdk/gdkrgb.h @@ -27,6 +27,8 @@ #ifndef __GDK_RGB_H__ #define __GDK_RGB_H__ +#include <gdk/gdktypes.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c index 3ee2e43b3d..ebffc3579c 100644 --- a/gdk/gdkselection.c +++ b/gdk/gdkselection.c @@ -27,7 +27,9 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <string.h> -#include "gdk.h" + +#include "gdkproperty.h" +#include "gdkselection.h" #include "gdkprivate.h" #include "gdkx.h" diff --git a/gdk/gdkselection.h b/gdk/gdkselection.h new file mode 100644 index 0000000000..d8f7d6e1f3 --- /dev/null +++ b/gdk/gdkselection.h @@ -0,0 +1,65 @@ +#ifndef __GDK_SELECTION_H__ +#define __GDK_SELECTION_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* The next three types define enums for predefined atoms relating + to selections. In general, one will need to use gdk_intern_atom */ + +typedef enum +{ + GDK_SELECTION_PRIMARY = 1, + GDK_SELECTION_SECONDARY = 2 +} GdkSelection; + +typedef enum +{ + GDK_TARGET_BITMAP = 5, + GDK_TARGET_COLORMAP = 7, + GDK_TARGET_DRAWABLE = 17, + GDK_TARGET_PIXMAP = 20, + GDK_TARGET_STRING = 31 +} GdkTarget; + +typedef enum +{ + GDK_SELECTION_TYPE_ATOM = 4, + GDK_SELECTION_TYPE_BITMAP = 5, + GDK_SELECTION_TYPE_COLORMAP = 7, + GDK_SELECTION_TYPE_DRAWABLE = 17, + GDK_SELECTION_TYPE_INTEGER = 19, + GDK_SELECTION_TYPE_PIXMAP = 20, + GDK_SELECTION_TYPE_WINDOW = 33, + GDK_SELECTION_TYPE_STRING = 31 +} GdkSelectionType; + +/* Selections + */ +gboolean gdk_selection_owner_set (GdkWindow *owner, + GdkAtom selection, + guint32 time, + gint send_event); +GdkWindow* gdk_selection_owner_get (GdkAtom selection); +void gdk_selection_convert (GdkWindow *requestor, + GdkAtom selection, + GdkAtom target, + guint32 time); +gboolean gdk_selection_property_get (GdkWindow *requestor, + guchar **data, + GdkAtom *prop_type, + gint *prop_format); +void gdk_selection_send_notify (guint32 requestor, + GdkAtom selection, + GdkAtom target, + GdkAtom property, + guint32 time); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_SELECTION_H__ */ diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h index ed168bf5ff..2584e49af3 100644 --- a/gdk/gdktypes.h +++ b/gdk/gdktypes.h @@ -27,7 +27,6 @@ #ifndef __GDK_TYPES_H__ #define __GDK_TYPES_H__ - /* GDK uses "glib". (And so does GTK). */ #include <glib.h> @@ -65,424 +64,34 @@ extern "C" { /* Type definitions for the basic structures. */ - -typedef gulong GdkAtom; -typedef struct _GdkColor GdkColor; -typedef struct _GdkColormap GdkColormap; -typedef struct _GdkVisual GdkVisual; -typedef struct _GdkWindowAttr GdkWindowAttr; -typedef struct _GdkWindow GdkWindow; -typedef struct _GdkWindow GdkPixmap; -typedef struct _GdkWindow GdkBitmap; -typedef struct _GdkWindow GdkDrawable; -typedef struct _GdkGeometry GdkGeometry; -typedef struct _GdkImage GdkImage; -typedef struct _GdkGCValues GdkGCValues; -typedef struct _GdkGC GdkGC; typedef struct _GdkPoint GdkPoint; typedef struct _GdkRectangle GdkRectangle; typedef struct _GdkSegment GdkSegment; -typedef struct _GdkFont GdkFont; -typedef struct _GdkCursor GdkCursor; -typedef struct _GdkColorContextDither GdkColorContextDither; -typedef struct _GdkColorContext GdkColorContext; -typedef struct _GdkDragContext GdkDragContext; - -typedef struct _GdkEventAny GdkEventAny; -typedef struct _GdkEventExpose GdkEventExpose; -typedef struct _GdkEventNoExpose GdkEventNoExpose; -typedef struct _GdkEventVisibility GdkEventVisibility; -typedef struct _GdkEventMotion GdkEventMotion; -typedef struct _GdkEventButton GdkEventButton; -typedef struct _GdkEventKey GdkEventKey; -typedef struct _GdkEventFocus GdkEventFocus; -typedef struct _GdkEventCrossing GdkEventCrossing; -typedef struct _GdkEventConfigure GdkEventConfigure; -typedef struct _GdkEventProperty GdkEventProperty; -typedef struct _GdkEventSelection GdkEventSelection; -typedef struct _GdkEventProximity GdkEventProximity; -typedef struct _GdkEventClient GdkEventClient; - -typedef struct _GdkEventDND GdkEventDND; - -typedef union _GdkEvent GdkEvent; - -typedef struct _GdkDeviceKey GdkDeviceKey; -typedef struct _GdkDeviceInfo GdkDeviceInfo; -typedef struct _GdkTimeCoord GdkTimeCoord; -typedef struct _GdkRegion GdkRegion; -typedef void (*GdkEventFunc) (GdkEvent *event, - gpointer data); - -typedef struct _GdkIC GdkIC; -typedef struct _GdkICAttr GdkICAttr; typedef guint32 GdkWChar; +typedef gulong GdkAtom; - -/* Types of windows. - * Root: There is only 1 root window and it is initialized - * at startup. Creating a window of type GDK_WINDOW_ROOT - * is an error. - * Toplevel: Windows which interact with the window manager. - * Child: Windows which are children of some other type of window. - * (Any other type of window). Most windows are child windows. - * Dialog: A special kind of toplevel window which interacts with - * the window manager slightly differently than a regular - * toplevel window. Dialog windows should be used for any - * transient window. - * Pixmap: Pixmaps are really just another kind of window which - * doesn't actually appear on the screen. It can't have - * children, either and is really just a convenience so - * that the drawing functions can work on both windows - * and pixmaps transparently. (ie. You shouldn't pass a - * pixmap to any procedure which accepts a window with the - * exception of the drawing functions). - * Foreign: A window that actually belongs to another application - */ -typedef enum -{ - GDK_WINDOW_ROOT, - GDK_WINDOW_TOPLEVEL, - GDK_WINDOW_CHILD, - GDK_WINDOW_DIALOG, - GDK_WINDOW_TEMP, - GDK_WINDOW_PIXMAP, - GDK_WINDOW_FOREIGN -} GdkWindowType; - -/* Classes of windows. - * InputOutput: Almost every window should be of this type. Such windows - * receive events and are also displayed on screen. - * InputOnly: Used only in special circumstances when events need to be - * stolen from another window or windows. Input only windows - * have no visible output, so they are handy for placing over - * top of a group of windows in order to grab the events (or - * filter the events) from those windows. - */ -typedef enum -{ - GDK_INPUT_OUTPUT, - GDK_INPUT_ONLY -} GdkWindowClass; - -/* Types of images. - * Normal: Normal X image type. These are slow as they involve passing - * the entire image through the X connection each time a draw - * request is required. On Win32, a bitmap. - * Shared: Shared memory X image type. These are fast as the X server - * and the program actually use the same piece of memory. They - * should be used with care though as there is the possibility - * for both the X server and the program to be reading/writing - * the image simultaneously and producing undesired results. - * On Win32, also a bitmap. - * Shared Pixmap: Also a shared memory image, which also has a - * pixmap using the same memory. Used by gdk_imlib with the - * Win32 backend. - */ -typedef enum -{ - GDK_IMAGE_NORMAL, - GDK_IMAGE_SHARED, - GDK_IMAGE_FASTEST, - GDK_IMAGE_SHARED_PIXMAP -} GdkImageType; - -/* Types of visuals. - * StaticGray: - * Grayscale: - * StaticColor: - * PseudoColor: - * TrueColor: - * DirectColor: - */ -typedef enum -{ - GDK_VISUAL_STATIC_GRAY, - GDK_VISUAL_GRAYSCALE, - GDK_VISUAL_STATIC_COLOR, - GDK_VISUAL_PSEUDO_COLOR, - GDK_VISUAL_TRUE_COLOR, - GDK_VISUAL_DIRECT_COLOR -} GdkVisualType; - -/* Types of font. - * GDK_FONT_FONT: the font is an XFontStruct. - * GDK_FONT_FONTSET: the font is an XFontSet used for I18N. - */ -typedef enum -{ - GDK_FONT_FONT, - GDK_FONT_FONTSET -} GdkFontType; - -/* Window attribute mask values. - * GDK_WA_TITLE: The "title" field is valid. - * GDK_WA_X: The "x" field is valid. - * GDK_WA_Y: The "y" field is valid. - * GDK_WA_CURSOR: The "cursor" field is valid. - * GDK_WA_COLORMAP: The "colormap" field is valid. - * GDK_WA_VISUAL: The "visual" field is valid. - */ -typedef enum -{ - GDK_WA_TITLE = 1 << 1, - GDK_WA_X = 1 << 2, - GDK_WA_Y = 1 << 3, - GDK_WA_CURSOR = 1 << 4, - GDK_WA_COLORMAP = 1 << 5, - GDK_WA_VISUAL = 1 << 6, - GDK_WA_WMCLASS = 1 << 7, - GDK_WA_NOREDIR = 1 << 8 -} GdkWindowAttributesType; - -/* Size restriction enumeration. - */ -typedef enum -{ - GDK_HINT_POS = 1 << 0, - GDK_HINT_MIN_SIZE = 1 << 1, - GDK_HINT_MAX_SIZE = 1 << 2, - GDK_HINT_BASE_SIZE = 1 << 3, - GDK_HINT_ASPECT = 1 << 4, - GDK_HINT_RESIZE_INC = 1 << 5 -} GdkWindowHints; - -/* GC function types. - * Copy: Overwrites destination pixels with the source pixels. - * Invert: Inverts the destination pixels. - * Xor: Xor's the destination pixels with the source pixels. - * Clear: set pixels to 0 - * And: source AND destination - * And Reverse: source AND (NOT destination) - * And Invert: (NOT source) AND destination - * Noop: destination - * Or: source OR destination - * Nor: (NOT source) AND (NOT destination) - * Equiv: (NOT source) XOR destination - * Xor Reverse: source OR (NOT destination) - * Copy Inverted: NOT source - * Xor Inverted: (NOT source) OR destination - * Nand: (NOT source) OR (NOT destination) - * Set: set pixels to 1 - */ -typedef enum -{ - GDK_COPY, - GDK_INVERT, - GDK_XOR, - GDK_CLEAR, - GDK_AND, - GDK_AND_REVERSE, - GDK_AND_INVERT, - GDK_NOOP, - GDK_OR, - GDK_EQUIV, - GDK_OR_REVERSE, - GDK_COPY_INVERT, - GDK_OR_INVERT, - GDK_NAND, - GDK_SET -} GdkFunction; - -/* GC fill types. - * Solid: - * Tiled: - * Stippled: - * OpaqueStippled: - */ -typedef enum -{ - GDK_SOLID, - GDK_TILED, - GDK_STIPPLED, - GDK_OPAQUE_STIPPLED -} GdkFill; - -/* GC fill rule for polygons - * EvenOddRule - * WindingRule - */ -typedef enum -{ - GDK_EVEN_ODD_RULE, - GDK_WINDING_RULE -} GdkFillRule; - -/* GC line styles - * Solid: - * OnOffDash: - * DoubleDash: - */ -typedef enum -{ - GDK_LINE_SOLID, - GDK_LINE_ON_OFF_DASH, - GDK_LINE_DOUBLE_DASH -} GdkLineStyle; - -/* GC cap styles - * CapNotLast: - * CapButt: - * CapRound: - * CapProjecting: - */ -typedef enum -{ - GDK_CAP_NOT_LAST, - GDK_CAP_BUTT, - GDK_CAP_ROUND, - GDK_CAP_PROJECTING -} GdkCapStyle; - -/* GC join styles - * JoinMiter: - * JoinRound: - * JoinBevel: - */ -typedef enum -{ - GDK_JOIN_MITER, - GDK_JOIN_ROUND, - GDK_JOIN_BEVEL -} GdkJoinStyle; - -/* Cursor types. - */ -typedef enum -{ -#include <gdk/gdkcursors.h> - GDK_LAST_CURSOR, - GDK_CURSOR_IS_PIXMAP = -1 -} GdkCursorType; - -typedef enum { - GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */ - GDK_FILTER_TRANSLATE, /* Translated event stored */ - GDK_FILTER_REMOVE /* Terminate processing, removing event */ -} GdkFilterReturn; - -typedef enum { - GDK_VISIBILITY_UNOBSCURED, - GDK_VISIBILITY_PARTIAL, - GDK_VISIBILITY_FULLY_OBSCURED -} GdkVisibilityState; - -/* Event types. - * Nothing: No event occurred. - * Delete: A window delete event was sent by the window manager. - * The specified window should be deleted. - * Destroy: A window has been destroyed. - * Expose: Part of a window has been uncovered. - * NoExpose: Same as expose, but no expose event was generated. - * VisibilityNotify: A window has become fully/partially/not obscured. - * MotionNotify: The mouse has moved. - * ButtonPress: A mouse button was pressed. - * ButtonRelease: A mouse button was release. - * KeyPress: A key was pressed. - * KeyRelease: A key was released. - * EnterNotify: A window was entered. - * LeaveNotify: A window was exited. - * FocusChange: The focus window has changed. (The focus window gets - * keyboard events). - * Resize: A window has been resized. - * Map: A window has been mapped. (It is now visible on the screen). - * Unmap: A window has been unmapped. (It is no longer visible on - * the screen). - */ -typedef enum -{ - GDK_NOTHING = -1, - GDK_DELETE = 0, - GDK_DESTROY = 1, - GDK_EXPOSE = 2, - GDK_MOTION_NOTIFY = 3, - GDK_BUTTON_PRESS = 4, - GDK_2BUTTON_PRESS = 5, - GDK_3BUTTON_PRESS = 6, - GDK_BUTTON_RELEASE = 7, - GDK_KEY_PRESS = 8, - GDK_KEY_RELEASE = 9, - GDK_ENTER_NOTIFY = 10, - GDK_LEAVE_NOTIFY = 11, - GDK_FOCUS_CHANGE = 12, - GDK_CONFIGURE = 13, - GDK_MAP = 14, - GDK_UNMAP = 15, - GDK_PROPERTY_NOTIFY = 16, - GDK_SELECTION_CLEAR = 17, - GDK_SELECTION_REQUEST = 18, - GDK_SELECTION_NOTIFY = 19, - GDK_PROXIMITY_IN = 20, - GDK_PROXIMITY_OUT = 21, - GDK_DRAG_ENTER = 22, - GDK_DRAG_LEAVE = 23, - GDK_DRAG_MOTION = 24, - GDK_DRAG_STATUS = 25, - GDK_DROP_START = 26, - GDK_DROP_FINISHED = 27, - GDK_CLIENT_EVENT = 28, - GDK_VISIBILITY_NOTIFY = 29, - GDK_NO_EXPOSE = 30 -} GdkEventType; - -/* Event masks. (Used to select what types of events a window - * will receive). +/* Forward declarations of commonly used types */ -typedef enum -{ - GDK_EXPOSURE_MASK = 1 << 1, - GDK_POINTER_MOTION_MASK = 1 << 2, - GDK_POINTER_MOTION_HINT_MASK = 1 << 3, - GDK_BUTTON_MOTION_MASK = 1 << 4, - GDK_BUTTON1_MOTION_MASK = 1 << 5, - GDK_BUTTON2_MOTION_MASK = 1 << 6, - GDK_BUTTON3_MOTION_MASK = 1 << 7, - GDK_BUTTON_PRESS_MASK = 1 << 8, - GDK_BUTTON_RELEASE_MASK = 1 << 9, - GDK_KEY_PRESS_MASK = 1 << 10, - GDK_KEY_RELEASE_MASK = 1 << 11, - GDK_ENTER_NOTIFY_MASK = 1 << 12, - GDK_LEAVE_NOTIFY_MASK = 1 << 13, - GDK_FOCUS_CHANGE_MASK = 1 << 14, - GDK_STRUCTURE_MASK = 1 << 15, - GDK_PROPERTY_CHANGE_MASK = 1 << 16, - GDK_VISIBILITY_NOTIFY_MASK = 1 << 17, - GDK_PROXIMITY_IN_MASK = 1 << 18, - GDK_PROXIMITY_OUT_MASK = 1 << 19, - GDK_SUBSTRUCTURE_MASK = 1 << 20, - GDK_ALL_EVENTS_MASK = 0x0FFFFF -} GdkEventMask; +typedef struct _GdkColor GdkColor; +typedef struct _GdkColormap GdkColormap; +typedef struct _GdkCursor GdkCursor; +typedef struct _GdkFont GdkFont; +typedef struct _GdkGC GdkGC; +typedef struct _GdkImage GdkImage; +typedef struct _GdkRegion GdkRegion; +typedef struct _GdkVisual GdkVisual; -/* Types of enter/leave notifications. - * Ancestor: - * Virtual: - * Inferior: - * Nonlinear: - * NonlinearVirtual: - * Unknown: An unknown type of enter/leave event occurred. - */ -typedef enum -{ - GDK_NOTIFY_ANCESTOR = 0, - GDK_NOTIFY_VIRTUAL = 1, - GDK_NOTIFY_INFERIOR = 2, - GDK_NOTIFY_NONLINEAR = 3, - GDK_NOTIFY_NONLINEAR_VIRTUAL = 4, - GDK_NOTIFY_UNKNOWN = 5 -} GdkNotifyType; +typedef struct _GdkWindow GdkBitmap; +typedef struct _GdkWindow GdkDrawable; +typedef struct _GdkWindow GdkPixmap; +typedef struct _GdkWindow GdkWindow; -/* Enter/leave event modes. - * NotifyNormal - * NotifyGrab - * NotifyUngrab - */ typedef enum { - GDK_CROSSING_NORMAL, - GDK_CROSSING_GRAB, - GDK_CROSSING_UNGRAB -} GdkCrossingMode; + GDK_LSB_FIRST, + GDK_MSB_FIRST +} GdkByteOrder; /* Types of modifiers. */ @@ -507,12 +116,6 @@ typedef enum typedef enum { - GDK_CLIP_BY_CHILDREN = 0, - GDK_INCLUDE_INFERIORS = 1 -} GdkSubwindowMode; - -typedef enum -{ GDK_INPUT_READ = 1 << 0, GDK_INPUT_WRITE = 1 << 1, GDK_INPUT_EXCEPTION = 1 << 2 @@ -527,383 +130,12 @@ typedef enum GDK_ERROR_MEM = -4 } GdkStatus; -typedef enum -{ - GDK_LSB_FIRST, - GDK_MSB_FIRST -} GdkByteOrder; - -typedef enum -{ - GDK_GC_FOREGROUND = 1 << 0, - GDK_GC_BACKGROUND = 1 << 1, - GDK_GC_FONT = 1 << 2, - GDK_GC_FUNCTION = 1 << 3, - GDK_GC_FILL = 1 << 4, - GDK_GC_TILE = 1 << 5, - GDK_GC_STIPPLE = 1 << 6, - GDK_GC_CLIP_MASK = 1 << 7, - GDK_GC_SUBWINDOW = 1 << 8, - GDK_GC_TS_X_ORIGIN = 1 << 9, - GDK_GC_TS_Y_ORIGIN = 1 << 10, - GDK_GC_CLIP_X_ORIGIN = 1 << 11, - GDK_GC_CLIP_Y_ORIGIN = 1 << 12, - GDK_GC_EXPOSURES = 1 << 13, - GDK_GC_LINE_WIDTH = 1 << 14, - GDK_GC_LINE_STYLE = 1 << 15, - GDK_GC_CAP_STYLE = 1 << 16, - GDK_GC_JOIN_STYLE = 1 << 17 -} GdkGCValuesMask; - -typedef enum -{ - GDK_SELECTION_PRIMARY = 1, - GDK_SELECTION_SECONDARY = 2 -} GdkSelection; - -typedef enum -{ - GDK_PROPERTY_NEW_VALUE, - GDK_PROPERTY_DELETE -} GdkPropertyState; - -typedef enum -{ - GDK_PROP_MODE_REPLACE, - GDK_PROP_MODE_PREPEND, - GDK_PROP_MODE_APPEND -} GdkPropMode; - -/* Enums for XInput support */ - -typedef enum -{ - GDK_SOURCE_MOUSE, - GDK_SOURCE_PEN, - GDK_SOURCE_ERASER, - GDK_SOURCE_CURSOR -} GdkInputSource; - -typedef enum -{ - GDK_MODE_DISABLED, - GDK_MODE_SCREEN, - GDK_MODE_WINDOW -} GdkInputMode; - -typedef enum -{ - GDK_AXIS_IGNORE, - GDK_AXIS_X, - GDK_AXIS_Y, - GDK_AXIS_PRESSURE, - GDK_AXIS_XTILT, - GDK_AXIS_YTILT, - GDK_AXIS_LAST -} GdkAxisUse; - -/* The next two types define enums for predefined atoms relating - to selections. In general, one will need to use gdk_intern_atom */ - -typedef enum -{ - GDK_TARGET_BITMAP = 5, - GDK_TARGET_COLORMAP = 7, - GDK_TARGET_DRAWABLE = 17, - GDK_TARGET_PIXMAP = 20, - GDK_TARGET_STRING = 31 -} GdkTarget; - -typedef enum -{ - GDK_SELECTION_TYPE_ATOM = 4, - GDK_SELECTION_TYPE_BITMAP = 5, - GDK_SELECTION_TYPE_COLORMAP = 7, - GDK_SELECTION_TYPE_DRAWABLE = 17, - GDK_SELECTION_TYPE_INTEGER = 19, - GDK_SELECTION_TYPE_PIXMAP = 20, - GDK_SELECTION_TYPE_WINDOW = 33, - GDK_SELECTION_TYPE_STRING = 31 -} GdkSelectionType; - -typedef enum -{ - GDK_EXTENSION_EVENTS_NONE, - GDK_EXTENSION_EVENTS_ALL, - GDK_EXTENSION_EVENTS_CURSOR -} GdkExtensionMode; - -typedef enum /*< flags >*/ -{ - GDK_IM_PREEDIT_AREA = 0x0001, - GDK_IM_PREEDIT_CALLBACKS = 0x0002, - GDK_IM_PREEDIT_POSITION = 0x0004, - GDK_IM_PREEDIT_NOTHING = 0x0008, - GDK_IM_PREEDIT_NONE = 0x0010, - GDK_IM_PREEDIT_MASK = 0x001f, - - GDK_IM_STATUS_AREA = 0x0100, - GDK_IM_STATUS_CALLBACKS = 0x0200, - GDK_IM_STATUS_NOTHING = 0x0400, - GDK_IM_STATUS_NONE = 0x0800, - GDK_IM_STATUS_MASK = 0x0f00 -} GdkIMStyle; - -typedef enum -{ - GDK_IC_STYLE = 1 << 0, - GDK_IC_CLIENT_WINDOW = 1 << 1, - GDK_IC_FOCUS_WINDOW = 1 << 2, - GDK_IC_FILTER_EVENTS = 1 << 3, - GDK_IC_SPOT_LOCATION = 1 << 4, - GDK_IC_LINE_SPACING = 1 << 5, - GDK_IC_CURSOR = 1 << 6, - - GDK_IC_PREEDIT_FONTSET = 1 << 10, - GDK_IC_PREEDIT_AREA = 1 << 11, - GDK_IC_PREEDIT_AREA_NEEDED = 1 << 12, - GDK_IC_PREEDIT_FOREGROUND = 1 << 13, - GDK_IC_PREEDIT_BACKGROUND = 1 << 14, - GDK_IC_PREEDIT_PIXMAP = 1 << 15, - GDK_IC_PREEDIT_COLORMAP = 1 << 16, - - GDK_IC_STATUS_FONTSET = 1 << 21, - GDK_IC_STATUS_AREA = 1 << 22, - GDK_IC_STATUS_AREA_NEEDED = 1 << 23, - GDK_IC_STATUS_FOREGROUND = 1 << 24, - GDK_IC_STATUS_BACKGROUND = 1 << 25, - GDK_IC_STATUS_PIXMAP = 1 << 26, - GDK_IC_STATUS_COLORMAP = 1 << 27, - - GDK_IC_ALL_REQ = GDK_IC_STYLE | - GDK_IC_CLIENT_WINDOW, - - GDK_IC_PREEDIT_AREA_REQ = GDK_IC_PREEDIT_AREA | - GDK_IC_PREEDIT_FONTSET, - GDK_IC_PREEDIT_POSITION_REQ = GDK_IC_PREEDIT_AREA | GDK_IC_SPOT_LOCATION | - GDK_IC_PREEDIT_FONTSET, - - GDK_IC_STATUS_AREA_REQ = GDK_IC_STATUS_AREA | - GDK_IC_STATUS_FONTSET -} GdkICAttributesType; - -/* The next two enumeration values current match the - * Motif constants. If this is changed, the implementation - * of gdk_window_set_decorations/gdk_window_set_functions - * will need to change as well. - */ -typedef enum -{ - GDK_DECOR_ALL = 1 << 0, - GDK_DECOR_BORDER = 1 << 1, - GDK_DECOR_RESIZEH = 1 << 2, - GDK_DECOR_TITLE = 1 << 3, - GDK_DECOR_MENU = 1 << 4, - GDK_DECOR_MINIMIZE = 1 << 5, - GDK_DECOR_MAXIMIZE = 1 << 6 -} GdkWMDecoration; - -typedef enum -{ - GDK_FUNC_ALL = 1 << 0, - GDK_FUNC_RESIZE = 1 << 1, - GDK_FUNC_MOVE = 1 << 2, - GDK_FUNC_MINIMIZE = 1 << 3, - GDK_FUNC_MAXIMIZE = 1 << 4, - GDK_FUNC_CLOSE = 1 << 5 -} GdkWMFunction; - typedef void (*GdkInputFunction) (gpointer data, gint source, GdkInputCondition condition); typedef void (*GdkDestroyNotify) (gpointer data); -/* Color Context modes. - * - * GDK_CC_MODE_UNDEFINED - unknown - * GDK_CC_MODE_BW - default B/W - * GDK_CC_MODE_STD_CMAP - has a standard colormap - * GDK_CC_MODE_TRUE - is a TrueColor/DirectColor visual - * GDK_CC_MODE_MY_GRAY - my grayramp - * GDK_CC_MODE_PALETTE - has a pre-allocated palette - */ - -typedef enum -{ - GDK_CC_MODE_UNDEFINED, - GDK_CC_MODE_BW, - GDK_CC_MODE_STD_CMAP, - GDK_CC_MODE_TRUE, - GDK_CC_MODE_MY_GRAY, - GDK_CC_MODE_PALETTE -} GdkColorContextMode; - -/* Types of overlapping between a rectangle and a region - * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region - * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region - * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region - */ - -typedef enum -{ - GDK_OVERLAP_RECTANGLE_IN, - GDK_OVERLAP_RECTANGLE_OUT, - GDK_OVERLAP_RECTANGLE_PART -} GdkOverlapType; - -typedef enum { - GDK_ACTION_DEFAULT = 1 << 0, - GDK_ACTION_COPY = 1 << 1, - GDK_ACTION_MOVE = 1 << 2, - GDK_ACTION_LINK = 1 << 3, - GDK_ACTION_PRIVATE = 1 << 4, - GDK_ACTION_ASK = 1 << 5 -} GdkDragAction; - -typedef enum { - GDK_DRAG_PROTO_MOTIF, - GDK_DRAG_PROTO_XDND, - GDK_DRAG_PROTO_ROOTWIN, /* A root window with nobody claiming - * drags */ - GDK_DRAG_PROTO_NONE, /* Not a valid drag window */ - GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */ - GDK_DRAG_PROTO_OLE2, /* The complex OLE2 dnd (not implemented) */ -} GdkDragProtocol; - -/* The color type. - * A color consists of red, green and blue values in the - * range 0-65535 and a pixel value. The pixel value is highly - * dependent on the depth and colormap which this color will - * be used to draw into. Therefore, sharing colors between - * colormaps is a bad idea. - */ -struct _GdkColor -{ - gulong pixel; - gushort red; - gushort green; - gushort blue; -}; - -/* The colormap type. - * Colormaps consist of 256 colors. - */ -struct _GdkColormap -{ - gint size; - GdkColor *colors; -}; - -/* The visual type. - * "type" is the type of visual this is (PseudoColor, TrueColor, etc). - * "depth" is the bit depth of this visual. - * "colormap_size" is the size of a colormap for this visual. - * "bits_per_rgb" is the number of significant bits per red, green and blue. - * The red, green and blue masks, shifts and precisions refer - * to value needed to calculate pixel values in TrueColor and DirectColor - * visuals. The "mask" is the significant bits within the pixel. The - * "shift" is the number of bits left we must shift a primary for it - * to be in position (according to the "mask"). "prec" refers to how - * much precision the pixel value contains for a particular primary. - */ -struct _GdkVisual -{ - GdkVisualType type; - gint depth; - GdkByteOrder byte_order; - gint colormap_size; - gint bits_per_rgb; - - guint32 red_mask; - gint red_shift; - gint red_prec; - - guint32 green_mask; - gint green_shift; - gint green_prec; - - guint32 blue_mask; - gint blue_shift; - gint blue_prec; -}; - -struct _GdkWindowAttr -{ - gchar *title; - gint event_mask; - gint16 x, y; - gint16 width; - gint16 height; - GdkWindowClass wclass; - GdkVisual *visual; - GdkColormap *colormap; - GdkWindowType window_type; - GdkCursor *cursor; - gchar *wmclass_name; - gchar *wmclass_class; - gboolean override_redirect; -}; - -struct _GdkWindow -{ - gpointer user_data; -}; - -struct _GdkGeometry { - gint min_width; - gint min_height; - gint max_width; - gint max_height; - gint base_width; - gint base_height; - gint width_inc; - gint height_inc; - gdouble min_aspect; - gdouble max_aspect; - /* GdkGravity gravity; */ -}; - -struct _GdkImage -{ - GdkImageType type; - GdkVisual *visual; /* visual used to create the image */ - GdkByteOrder byte_order; - guint16 width; - guint16 height; - guint16 depth; - guint16 bpp; /* bytes per pixel */ - guint16 bpl; /* bytes per line */ - gpointer mem; -}; - -struct _GdkGCValues -{ - GdkColor foreground; - GdkColor background; - GdkFont *font; - GdkFunction function; - GdkFill fill; - GdkPixmap *tile; - GdkPixmap *stipple; - GdkPixmap *clip_mask; - GdkSubwindowMode subwindow_mode; - gint ts_x_origin; - gint ts_y_origin; - gint clip_x_origin; - gint clip_y_origin; - gint graphics_exposures; - gint line_width; - GdkLineStyle line_style; - GdkCapStyle cap_style; - GdkJoinStyle join_style; -}; - -struct _GdkGC -{ - gint dummy_var; -}; - struct _GdkPoint { gint16 x; @@ -926,361 +158,6 @@ struct _GdkSegment gint16 y2; }; -struct _GdkFont -{ - GdkFontType type; - gint ascent; - gint descent; -}; - -struct _GdkCursor -{ - GdkCursorType type; -}; - - -struct _GdkColorContextDither -{ - gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */ - gint fast_err[32][32][32]; /* internal RGB error information */ - gint fast_erg[32][32][32]; - gint fast_erb[32][32][32]; -}; - -struct _GdkColorContext -{ - GdkVisual *visual; - GdkColormap *colormap; - - gint num_colors; /* available no. of colors in colormap */ - gint max_colors; /* maximum no. of colors */ - gint num_allocated; /* no. of allocated colors */ - - GdkColorContextMode mode; - gint need_to_free_colormap; - GdkAtom std_cmap_atom; - - gulong *clut; /* color look-up table */ - GdkColor *cmap; /* colormap */ - - GHashTable *color_hash; /* hash table of allocated colors */ - GdkColor *palette; /* preallocated palette */ - gint num_palette; /* size of palette */ - - GdkColorContextDither *fast_dither; /* fast dither matrix */ - - struct - { - gint red; - gint green; - gint blue; - } shifts; - - struct - { - gulong red; - gulong green; - gulong blue; - } masks; - - struct - { - gint red; - gint green; - gint blue; - } bits; - - gulong max_entry; - - gulong black_pixel; - gulong white_pixel; -}; - -/* Types for XInput support */ - -struct _GdkDeviceKey -{ - guint keyval; - GdkModifierType modifiers; -}; - -struct _GdkDeviceInfo -{ - guint32 deviceid; - gchar *name; - GdkInputSource source; - GdkInputMode mode; - gint has_cursor; /* TRUE if the X pointer follows device motion */ - gint num_axes; - GdkAxisUse *axes; /* Specifies use for each axis */ - gint num_keys; - GdkDeviceKey *keys; -}; - -struct _GdkTimeCoord -{ - guint32 time; - gdouble x; - gdouble y; - gdouble pressure; - gdouble xtilt; - gdouble ytilt; -}; - -/* Structure that holds information about a drag in progress. - * this is used on both source and destination sides. - */ -struct _GdkDragContext { - GdkDragProtocol protocol; - - gboolean is_source; - - GdkWindow *source_window; - GdkWindow *dest_window; - - GList *targets; - GdkDragAction actions; - GdkDragAction suggested_action; - GdkDragAction action; - - guint32 start_time; -}; - -/* Event filtering */ - -typedef void GdkXEvent; /* Can be cast to XEvent */ - -typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent, - GdkEvent *event, - gpointer data); - -struct _GdkEventAny -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; -}; - -struct _GdkEventExpose -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkRectangle area; - gint count; /* If non-zero, how many more events follow. */ -}; - -struct _GdkEventNoExpose -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - /* XXX: does anyone need the X major_code or minor_code fields? */ -}; - -struct _GdkEventVisibility -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkVisibilityState state; -}; - -struct _GdkEventMotion -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - guint32 time; - gdouble x; - gdouble y; - gdouble pressure; - gdouble xtilt; - gdouble ytilt; - guint state; - gint16 is_hint; - GdkInputSource source; - guint32 deviceid; - gdouble x_root, y_root; -}; - -struct _GdkEventButton -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - guint32 time; - gdouble x; - gdouble y; - gdouble pressure; - gdouble xtilt; - gdouble ytilt; - guint state; - guint button; - GdkInputSource source; - guint32 deviceid; - gdouble x_root, y_root; -}; - -struct _GdkEventKey -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - guint32 time; - guint state; - guint keyval; - gint length; - gchar *string; -}; - -struct _GdkEventCrossing -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkWindow *subwindow; - guint32 time; - gdouble x; - gdouble y; - gdouble x_root; - gdouble y_root; - GdkCrossingMode mode; - GdkNotifyType detail; - gboolean focus; - guint state; -}; - -struct _GdkEventFocus -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - gint16 in; -}; - -struct _GdkEventConfigure -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - gint16 x, y; - gint16 width; - gint16 height; -}; - -struct _GdkEventProperty -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkAtom atom; - guint32 time; - guint state; -}; - -struct _GdkEventSelection -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkAtom selection; - GdkAtom target; - GdkAtom property; - guint32 requestor; - guint32 time; -}; - -/* This event type will be used pretty rarely. It only is important - for XInput aware programs that are drawing their own cursor */ - -struct _GdkEventProximity -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - guint32 time; - GdkInputSource source; - guint32 deviceid; -}; - -struct _GdkEventClient -{ - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkAtom message_type; - gushort data_format; - union { - char b[20]; - short s[10]; - long l[5]; - } data; -}; - -/* Event types for DND */ - -struct _GdkEventDND { - GdkEventType type; - GdkWindow *window; - gint8 send_event; - GdkDragContext *context; - - guint32 time; - gshort x_root, y_root; -}; - -union _GdkEvent -{ - GdkEventType type; - GdkEventAny any; - GdkEventExpose expose; - GdkEventNoExpose no_expose; - GdkEventVisibility visibility; - GdkEventMotion motion; - GdkEventButton button; - GdkEventKey key; - GdkEventCrossing crossing; - GdkEventFocus focus_change; - GdkEventConfigure configure; - GdkEventProperty property; - GdkEventSelection selection; - GdkEventProximity proximity; - GdkEventClient client; - GdkEventDND dnd; -}; - -struct _GdkRegion -{ - gpointer user_data; -}; - -struct _GdkICAttr -{ - GdkIMStyle style; - GdkWindow *client_window; - GdkWindow *focus_window; - GdkEventMask filter_events; - GdkPoint spot_location; - gint line_spacing; - GdkCursor *cursor; - - GdkFont *preedit_fontset; - GdkRectangle preedit_area; - GdkRectangle preedit_area_needed; - GdkColor preedit_foreground; - GdkColor preedit_background; - GdkPixmap *preedit_pixmap; - GdkColormap *preedit_colormap; - - GdkFont *status_fontset; - GdkRectangle status_area; - GdkRectangle status_area_needed; - GdkColor status_foreground; - GdkColor status_background; - GdkPixmap *status_pixmap; - GdkColormap *status_colormap; -}; #ifdef __cplusplus } diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c index a63ba55c6c..072ff456e5 100644 --- a/gdk/gdkvisual.c +++ b/gdk/gdkvisual.c @@ -26,10 +26,9 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> -#include "gdk.h" -#include "gdkprivate.h" -#include "gdkx.h" +#include "gdkvisual.h" +#include "gdkprivate.h" static void gdk_visual_add (GdkVisual *visual); static void gdk_visual_decompose_mask (gulong mask, diff --git a/gdk/gdkvisual.h b/gdk/gdkvisual.h new file mode 100644 index 0000000000..1bd58f9968 --- /dev/null +++ b/gdk/gdkvisual.h @@ -0,0 +1,85 @@ +#ifndef __GDK_VISUAL_H__ +#define __GDK_VISUAL_H__ + +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Types of visuals. + * StaticGray: + * Grayscale: + * StaticColor: + * PseudoColor: + * TrueColor: + * DirectColor: + */ +typedef enum +{ + GDK_VISUAL_STATIC_GRAY, + GDK_VISUAL_GRAYSCALE, + GDK_VISUAL_STATIC_COLOR, + GDK_VISUAL_PSEUDO_COLOR, + GDK_VISUAL_TRUE_COLOR, + GDK_VISUAL_DIRECT_COLOR +} GdkVisualType; + +/* The visual type. + * "type" is the type of visual this is (PseudoColor, TrueColor, etc). + * "depth" is the bit depth of this visual. + * "colormap_size" is the size of a colormap for this visual. + * "bits_per_rgb" is the number of significant bits per red, green and blue. + * The red, green and blue masks, shifts and precisions refer + * to value needed to calculate pixel values in TrueColor and DirectColor + * visuals. The "mask" is the significant bits within the pixel. The + * "shift" is the number of bits left we must shift a primary for it + * to be in position (according to the "mask"). "prec" refers to how + * much precision the pixel value contains for a particular primary. + */ +struct _GdkVisual +{ + GdkVisualType type; + gint depth; + GdkByteOrder byte_order; + gint colormap_size; + gint bits_per_rgb; + + guint32 red_mask; + gint red_shift; + gint red_prec; + + guint32 green_mask; + gint green_shift; + gint green_prec; + + guint32 blue_mask; + gint blue_shift; + gint blue_prec; +}; + +gint gdk_visual_get_best_depth (void); +GdkVisualType gdk_visual_get_best_type (void); +GdkVisual* gdk_visual_get_system (void); +GdkVisual* gdk_visual_get_best (void); +GdkVisual* gdk_visual_get_best_with_depth (gint depth); +GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type); +GdkVisual* gdk_visual_get_best_with_both (gint depth, + GdkVisualType visual_type); + +/* Actually, these are no-ops... */ +GdkVisual* gdk_visual_ref (GdkVisual *visual); +void gdk_visual_unref (GdkVisual *visual); + +void gdk_query_depths (gint **depths, + gint *count); +void gdk_query_visual_types (GdkVisualType **visual_types, + gint *count); + +GList* gdk_list_visuals (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_VISUAL_H__ */ diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 47b200c3e4..ddd5267eac 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -30,7 +30,9 @@ #include <netinet/in.h> #include "gdk.h" #include "config.h" -#include "gdkinput.h" + +#include "gdkwindow.h" +#include "gdkinputprivate.h" #include "gdkprivate.h" #include "MwmUtil.h" diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h new file mode 100644 index 0000000000..47f7444973 --- /dev/null +++ b/gdk/gdkwindow.h @@ -0,0 +1,320 @@ +#ifndef __GDK_WINDOW_H__ +#define __GDK_WINDOW_H__ + +#include <gdk/gdkdrawable.h> +#include <gdk/gdktypes.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _GdkGeometry GdkGeometry; +typedef struct _GdkWindowAttr GdkWindowAttr; + +/* Classes of windows. + * InputOutput: Almost every window should be of this type. Such windows + * receive events and are also displayed on screen. + * InputOnly: Used only in special circumstances when events need to be + * stolen from another window or windows. Input only windows + * have no visible output, so they are handy for placing over + * top of a group of windows in order to grab the events (or + * filter the events) from those windows. + */ +typedef enum +{ + GDK_INPUT_OUTPUT, + GDK_INPUT_ONLY +} GdkWindowClass; + + +/* Window attribute mask values. + * GDK_WA_TITLE: The "title" field is valid. + * GDK_WA_X: The "x" field is valid. + * GDK_WA_Y: The "y" field is valid. + * GDK_WA_CURSOR: The "cursor" field is valid. + * GDK_WA_COLORMAP: The "colormap" field is valid. + * GDK_WA_VISUAL: The "visual" field is valid. + */ +typedef enum +{ + GDK_WA_TITLE = 1 << 1, + GDK_WA_X = 1 << 2, + GDK_WA_Y = 1 << 3, + GDK_WA_CURSOR = 1 << 4, + GDK_WA_COLORMAP = 1 << 5, + GDK_WA_VISUAL = 1 << 6, + GDK_WA_WMCLASS = 1 << 7, + GDK_WA_NOREDIR = 1 << 8 +} GdkWindowAttributesType; + +/* Size restriction enumeration. + */ +typedef enum +{ + GDK_HINT_POS = 1 << 0, + GDK_HINT_MIN_SIZE = 1 << 1, + GDK_HINT_MAX_SIZE = 1 << 2, + GDK_HINT_BASE_SIZE = 1 << 3, + GDK_HINT_ASPECT = 1 << 4, + GDK_HINT_RESIZE_INC = 1 << 5 +} GdkWindowHints; + +/* The next two enumeration values current match the + * Motif constants. If this is changed, the implementation + * of gdk_window_set_decorations/gdk_window_set_functions + * will need to change as well. + */ +typedef enum +{ + GDK_DECOR_ALL = 1 << 0, + GDK_DECOR_BORDER = 1 << 1, + GDK_DECOR_RESIZEH = 1 << 2, + GDK_DECOR_TITLE = 1 << 3, + GDK_DECOR_MENU = 1 << 4, + GDK_DECOR_MINIMIZE = 1 << 5, + GDK_DECOR_MAXIMIZE = 1 << 6 +} GdkWMDecoration; + +typedef enum +{ + GDK_FUNC_ALL = 1 << 0, + GDK_FUNC_RESIZE = 1 << 1, + GDK_FUNC_MOVE = 1 << 2, + GDK_FUNC_MINIMIZE = 1 << 3, + GDK_FUNC_MAXIMIZE = 1 << 4, + GDK_FUNC_CLOSE = 1 << 5 +} GdkWMFunction; + +struct _GdkWindowAttr +{ + gchar *title; + gint event_mask; + gint16 x, y; + gint16 width; + gint16 height; + GdkWindowClass wclass; + GdkVisual *visual; + GdkColormap *colormap; + GdkWindowType window_type; + GdkCursor *cursor; + gchar *wmclass_name; + gchar *wmclass_class; + gboolean override_redirect; +}; + +struct _GdkGeometry { + gint min_width; + gint min_height; + gint max_width; + gint max_height; + gint base_width; + gint base_height; + gint width_inc; + gint height_inc; + gdouble min_aspect; + gdouble max_aspect; + /* GdkGravity gravity; */ +}; + +/* Windows + */ +GdkWindow* gdk_window_new (GdkWindow *parent, + GdkWindowAttr *attributes, + gint attributes_mask); + +void gdk_window_destroy (GdkWindow *window); +GdkWindow* gdk_window_ref (GdkWindow *window); +void gdk_window_unref (GdkWindow *window); + +GdkWindow* gdk_window_at_pointer (gint *win_x, + gint *win_y); +void gdk_window_show (GdkWindow *window); +void gdk_window_hide (GdkWindow *window); +void gdk_window_withdraw (GdkWindow *window); +void gdk_window_move (GdkWindow *window, + gint x, + gint y); +void gdk_window_resize (GdkWindow *window, + gint width, + gint height); +void gdk_window_move_resize (GdkWindow *window, + gint x, + gint y, + gint width, + gint height); +void gdk_window_reparent (GdkWindow *window, + GdkWindow *new_parent, + gint x, + gint y); +void gdk_window_clear (GdkWindow *window); +void gdk_window_clear_area (GdkWindow *window, + gint x, + gint y, + gint width, + gint height); +void gdk_window_clear_area_e(GdkWindow *window, + gint x, + gint y, + gint width, + gint height); +void gdk_window_copy_area (GdkWindow *window, + GdkGC *gc, + gint x, + gint y, + GdkWindow *source_window, + gint source_x, + gint source_y, + gint width, + gint height); +void gdk_window_raise (GdkWindow *window); +void gdk_window_lower (GdkWindow *window); + +void gdk_window_set_user_data (GdkWindow *window, + gpointer user_data); +void gdk_window_set_override_redirect(GdkWindow *window, + gboolean override_redirect); + +void gdk_window_add_filter (GdkWindow *window, + GdkFilterFunc function, + gpointer data); +void gdk_window_remove_filter (GdkWindow *window, + GdkFilterFunc function, + gpointer data); + +/* + * This allows for making shaped (partially transparent) windows + * - cool feature, needed for Drag and Drag for example. + * The shape_mask can be the mask + * from gdk_pixmap_create_from_xpm. Stefan Wille + */ +void gdk_window_shape_combine_mask (GdkWindow *window, + GdkBitmap *shape_mask, + gint offset_x, + gint offset_y); +/* + * This routine allows you to quickly take the shapes of all the child windows + * of a window and use their shapes as the shape mask for this window - useful + * for container windows that dont want to look like a big box + * + * - Raster + */ +void gdk_window_set_child_shapes (GdkWindow *window); + +/* + * This routine allows you to merge (ie ADD) child shapes to your + * own window's shape keeping its current shape and ADDING the child + * shapes to it. + * + * - Raster + */ +void gdk_window_merge_child_shapes (GdkWindow *window); + +/* + * Check if a window has been shown, and whether all it's + * parents up to a toplevel have been shown, respectively. + * Note that a window that is_viewable below is not necessarily + * viewable in the X sense. + */ +gboolean gdk_window_is_visible (GdkWindow *window); +gboolean gdk_window_is_viewable (GdkWindow *window); + +/* Set static bit gravity on the parent, and static + * window gravity on all children. + */ +gboolean gdk_window_set_static_gravities (GdkWindow *window, + gboolean use_static); + +/* GdkWindow */ + +void gdk_window_set_hints (GdkWindow *window, + gint x, + gint y, + gint min_width, + gint min_height, + gint max_width, + gint max_height, + gint flags); +void gdk_window_set_geometry_hints (GdkWindow *window, + GdkGeometry *geometry, + GdkWindowHints flags); +void gdk_set_sm_client_id (const gchar *sm_client_id); + + +void gdk_window_set_title (GdkWindow *window, + const gchar *title); +void gdk_window_set_role (GdkWindow *window, + const gchar *role); +void gdk_window_set_transient_for (GdkWindow *window, + GdkWindow *leader); +void gdk_window_set_background (GdkWindow *window, + GdkColor *color); +void gdk_window_set_back_pixmap (GdkWindow *window, + GdkPixmap *pixmap, + gint parent_relative); +void gdk_window_set_cursor (GdkWindow *window, + GdkCursor *cursor); +void gdk_window_set_colormap (GdkWindow *window, + GdkColormap *colormap); +void gdk_window_get_user_data (GdkWindow *window, + gpointer *data); +void gdk_window_get_geometry (GdkWindow *window, + gint *x, + gint *y, + gint *width, + gint *height, + gint *depth); +void gdk_window_get_position (GdkWindow *window, + gint *x, + gint *y); +void gdk_window_get_size (GdkWindow *window, + gint *width, + gint *height); +GdkVisual* gdk_window_get_visual (GdkWindow *window); +GdkColormap* gdk_window_get_colormap (GdkWindow *window); +GdkWindowType gdk_window_get_type (GdkWindow *window); +gint gdk_window_get_origin (GdkWindow *window, + gint *x, + gint *y); +gboolean gdk_window_get_deskrelative_origin (GdkWindow *window, + gint *x, + gint *y); +void gdk_window_get_root_origin (GdkWindow *window, + gint *x, + gint *y); +GdkWindow* gdk_window_get_pointer (GdkWindow *window, + gint *x, + gint *y, + GdkModifierType *mask); +GdkWindow* gdk_window_get_parent (GdkWindow *window); +GdkWindow* gdk_window_get_toplevel (GdkWindow *window); +GList* gdk_window_get_children (GdkWindow *window); +GdkEventMask gdk_window_get_events (GdkWindow *window); +void gdk_window_set_events (GdkWindow *window, + GdkEventMask event_mask); + +void gdk_window_set_icon (GdkWindow *window, + GdkWindow *icon_window, + GdkPixmap *pixmap, + GdkBitmap *mask); +void gdk_window_set_icon_name (GdkWindow *window, + gchar *name); +void gdk_window_set_group (GdkWindow *window, + GdkWindow *leader); +void gdk_window_set_decorations (GdkWindow *window, + GdkWMDecoration decorations); +void gdk_window_set_functions (GdkWindow *window, + GdkWMFunction functions); +GList * gdk_window_get_toplevels (void); + +void gdk_window_register_dnd (GdkWindow *window); + +void gdk_drawable_set_data (GdkDrawable *drawable, + const gchar *key, + gpointer data, + GDestroyNotify destroy_func); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GDK_WINDOW_H__ */ diff --git a/gdk/x11/gdkcc-x11.c b/gdk/x11/gdkcc-x11.c index d1d1e754f7..f592fa8e54 100644 --- a/gdk/x11/gdkcc-x11.c +++ b/gdk/x11/gdkcc-x11.c @@ -63,13 +63,21 @@ #include <X11/Xlib.h> #include <stdlib.h> #include <string.h> -#include "gdk.h" -#include "gdkprivate.h" -#include "gdkx.h" +#include "gdkcc.h" +#include "gdkcolor.h" +#include "gdkx.h" #define MAX_IMAGE_COLORS 256 +typedef struct _GdkColorContextPrivate GdkColorContextPrivate; + +struct _GdkColorContextPrivate +{ + GdkColorContext color_context; + Display *xdisplay; + XStandardColormap std_cmap; +}; static guint hash_color (gconstpointer key) diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index 2baa200ee0..03222cc3d6 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -26,9 +26,9 @@ #include <time.h> #include <X11/Xlib.h> -#include "gdk.h" + +#include "gdkcolor.h" #include "gdkprivate.h" -#include "gdkx.h" static gint gdk_colormap_match_color (GdkColormap *cmap, diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index 568c489dd5..6431c780ad 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -26,7 +26,8 @@ #include <X11/Xlib.h> #include <X11/cursorfont.h> -#include "gdk.h" + +#include "gdkcursor.h" #include "gdkprivate.h" diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index a2be5e160c..3788229245 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -27,9 +27,12 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <string.h> + +#include "gdk.h" /* For gdk_flush() */ +#include "gdkdnd.h" +#include "gdkproperty.h" +#include "gdkprivate.h" #include "gdkx.h" -#include "gdk/gdkprivate.h" -#include "gdk.h" typedef struct _GdkDragContextPrivate GdkDragContextPrivate; diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 4f6f577f29..2adc09cb45 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -25,8 +25,9 @@ */ #include "gdk.h" -#include "gdkx.h" #include "gdkprivate.h" +#include "gdkx.h" + #include "gdkkeysyms.h" #if HAVE_CONFIG_H @@ -36,7 +37,7 @@ # endif #endif -#include "gdkinput.h" +#include "gdkinputprivate.h" typedef struct _GdkIOClosure GdkIOClosure; typedef struct _GdkEventPrivate GdkEventPrivate; diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c index 096cf8a537..a3a3502fba 100644 --- a/gdk/x11/gdkfont-x11.c +++ b/gdk/x11/gdkfont-x11.c @@ -26,7 +26,7 @@ #include <X11/Xlib.h> #include <X11/Xos.h> -#include "gdk.h" +#include "gdkfont.h" #include "gdkprivate.h" static GHashTable *font_name_hash = NULL; diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c index e453925093..020460f329 100644 --- a/gdk/x11/gdkim-x11.c +++ b/gdk/x11/gdkim-x11.c @@ -25,7 +25,10 @@ */ #include <X11/Xlocale.h> -#include "gdk.h" + +#include "gdk.h" /* For gdk_flush() */ +#include "gdkim.h" +#include "gdkpixmap.h" #include "gdkprivate.h" #include "gdki18n.h" #include "gdkx.h" diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c index 7dae0d92ee..769727a4b6 100644 --- a/gdk/x11/gdkimage-x11.c +++ b/gdk/x11/gdkimage-x11.c @@ -53,7 +53,8 @@ #include <X11/extensions/XShm.h> #endif /* USE_SHM */ -#include "gdk.h" +#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */ +#include "gdkimage.h" #include "gdkprivate.h" diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c index b09821ff6e..8f75330067 100644 --- a/gdk/x11/gdkinput.c +++ b/gdk/x11/gdkinput.c @@ -28,11 +28,10 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include "config.h" -#include "gdk.h" -#include "gdkx.h" -#include "gdkprivate.h" -#include "gdkinput.h" +#include "gdkinput.h" +#include "gdkprivate.h" +#include "gdkinputprivate.h" /* Forward declarations */ diff --git a/gdk/x11/gdkinputprivate.h b/gdk/x11/gdkinputprivate.h new file mode 100644 index 0000000000..0f41c462b4 --- /dev/null +++ b/gdk/x11/gdkinputprivate.h @@ -0,0 +1,162 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GDK_INPUTPRIVATE_H__ +#define __GDK_INPUTPRIVATE_H__ + +#ifndef XINPUT_NONE +#include <X11/extensions/XInput.h> +#endif + +typedef struct _GdkAxisInfo GdkAxisInfo; +typedef struct _GdkInputVTable GdkInputVTable; +typedef struct _GdkDevicePrivate GdkDevicePrivate; +typedef struct _GdkInputWindow GdkInputWindow; + +struct _GdkInputVTable { + gint (*set_mode) (guint32 deviceid, GdkInputMode mode); + void (*set_axes) (guint32 deviceid, GdkAxisUse *axes); + void (*set_key) (guint32 deviceid, + guint index, + guint keyval, + GdkModifierType modifiers); + + GdkTimeCoord* (*motion_events) (GdkWindow *window, + guint32 deviceid, + guint32 start, + guint32 stop, + gint *nevents_return); + void (*get_pointer) (GdkWindow *window, + guint32 deviceid, + gdouble *x, + gdouble *y, + gdouble *pressure, + gdouble *xtilt, + gdouble *ytilt, + GdkModifierType *mask); + gint (*grab_pointer) (GdkWindow * window, + gint owner_events, + GdkEventMask event_mask, + GdkWindow * confine_to, + guint32 time); + void (*ungrab_pointer) (guint32 time); + + void (*configure_event) (XConfigureEvent *xevent, GdkWindow *window); + void (*enter_event) (XCrossingEvent *xevent, GdkWindow *window); + gint (*other_event) (GdkEvent *event, XEvent *xevent, GdkWindow *window); + /* Handle an unidentified event. Returns TRUE if handled, FALSE + otherwise */ + gint (*window_none_event) (GdkEvent *event, XEvent *xevent); + gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev); + gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev); +}; + +/* information about a device axis */ +struct _GdkAxisInfo +{ + /* reported x resolution */ + gint xresolution; + + /* reported x minimum/maximum values */ + gint xmin_value, xmax_value; + + /* calibrated resolution (for aspect ration) - only relative values + between axes used */ + gint resolution; + + /* calibrated minimum/maximum values */ + gint min_value, max_value; +}; + +#define GDK_INPUT_NUM_EVENTC 6 + +struct _GdkDevicePrivate { + GdkDeviceInfo info; + +#ifndef XINPUT_NONE + /* information about the axes */ + GdkAxisInfo *axes; + + /* reverse lookup on axis use type */ + gint axis_for_use[GDK_AXIS_LAST]; + + /* Information about XInput device */ + XDevice *xdevice; + + /* minimum key code for device */ + gint min_keycode; + + int buttonpress_type, buttonrelease_type, keypress_type, + keyrelease_type, motionnotify_type, proximityin_type, + proximityout_type, changenotify_type; + + /* true if we need to select a different set of events, but + can't because this is the core pointer */ + gint needs_update; + + /* Mask of buttons (used for button grabs) */ + gint button_state; + + /* true if we've claimed the device as active. (used only for XINPUT_GXI) */ + gint claimed; +#endif /* !XINPUT_NONE */ +}; + +struct _GdkInputWindow +{ + /* gdk window */ + GdkWindow *window; + + /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */ + GdkExtensionMode mode; + + /* position relative to root window */ + gint16 root_x; + gint16 root_y; + + /* rectangles relative to window of windows obscuring this one */ + GdkRectangle *obscuring; + gint num_obscuring; + + /* Is there a pointer grab for this window ? */ + gint grabbed; +}; + +/* Global data */ + +extern GdkInputVTable gdk_input_vtable; +/* information about network port and host for gxid daemon */ +extern gchar *gdk_input_gxid_host; +extern gint gdk_input_gxid_port; +extern gint gdk_input_ignore_core; + +/* Function declarations */ + +void gdk_input_window_destroy (GdkWindow *window); +void gdk_input_init (void); +void gdk_input_exit (void); + +#endif /* __GDK_INPUTPRIVATE_H__ */ diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index de1d55ea8c..96e342f62c 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -44,17 +44,11 @@ #include <X11/Xutil.h> #include <X11/Xmu/WinUtil.h> #include <X11/cursorfont.h> -#include "gdk.h" -#include "gdkprivate.h" -#include "gdkinput.h" -#include "gdkx.h" -#include "gdki18n.h" -#include "gdkkeysyms.h" -#ifndef X_GETTIMEOFDAY -#define X_GETTIMEOFDAY(tv) gettimeofday (tv, NULL) -#endif /* X_GETTIMEOFDAY */ +#include "gdk.h" +#include "gdkprivate.h" +#include "gdkinputprivate.h" typedef struct _GdkPredicate GdkPredicate; typedef struct _GdkErrorTrap GdkErrorTrap; @@ -97,23 +91,6 @@ static int gdk_initialized = 0; /* 1 if the library is initialized, * 0 otherwise. */ -static struct timeval start; /* The time at which the library was - * last initialized. - */ -static struct timeval timer; /* Timeout interval to use in the call - * to "select". This is used in - * conjunction with "timerp" to create - * a maximum time to wait for an event - * to arrive. - */ -static struct timeval *timerp; /* The actual timer passed to "select" - * This may be NULL, in which case - * "select" will block until an event - * arrives. - */ -static guint32 timer_val; /* The timeout length as specified by - * the user in milliseconds. - */ static gint autorepeat; static GSList *gdk_error_traps = NULL; /* List of error traps */ @@ -181,8 +158,6 @@ gdk_init_check (int *argc, argv_orig[argc_orig] = NULL; } - X_GETTIMEOFDAY (&start); - gdk_display_name = NULL; XSetErrorHandler (gdk_x_error); @@ -420,10 +395,6 @@ gdk_init_check (int *argc, XGetKeyboardControl (gdk_display, &keyboard_state); autorepeat = keyboard_state.global_auto_repeat; - timer.tv_sec = 0; - timer.tv_usec = 0; - timerp = NULL; - g_atexit (gdk_exit_func); gdk_events_init (); @@ -493,112 +464,6 @@ gdk_get_use_xshm (void) /* *-------------------------------------------------------------- - * gdk_time_get - * - * Get the number of milliseconds since the library was - * initialized. - * - * Arguments: - * - * Results: - * The time since the library was initialized is returned. - * This time value is accurate to milliseconds even though - * a more accurate time down to the microsecond could be - * returned. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_time_get (void) -{ - struct timeval end; - struct timeval elapsed; - guint32 milliseconds; - - X_GETTIMEOFDAY (&end); - - if (start.tv_usec > end.tv_usec) - { - end.tv_usec += 1000000; - end.tv_sec--; - } - elapsed.tv_sec = end.tv_sec - start.tv_sec; - elapsed.tv_usec = end.tv_usec - start.tv_usec; - - milliseconds = (elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000); - - return milliseconds; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_get - * - * Returns the current timer. - * - * Arguments: - * - * Results: - * Returns the current timer interval. This interval is - * in units of milliseconds. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_timer_get (void) -{ - return timer_val; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_set - * - * Sets the timer interval. - * - * Arguments: - * "milliseconds" is the new value for the timer. - * - * Results: - * - * Side effects: - * Calls to "gdk_event_get" will last for a maximum - * of time of "milliseconds". However, a value of 0 - * milliseconds will cause "gdk_event_get" to block - * indefinately until an event is received. - * - *-------------------------------------------------------------- - */ - -void -gdk_timer_set (guint32 milliseconds) -{ - timer_val = milliseconds; - timer.tv_sec = milliseconds / 1000; - timer.tv_usec = (milliseconds % 1000) * 1000; - -} - -void -gdk_timer_enable (void) -{ - timerp = &timer; -} - -void -gdk_timer_disable (void) -{ - timerp = NULL; -} - -/* - *-------------------------------------------------------------- * gdk_pointer_grab * * Grabs the pointer to a specific window diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index 6fc47e316e..5656b18a93 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -32,7 +32,7 @@ #include <unistd.h> #include <X11/Xlib.h> -#include "gdk.h" +#include "gdkpixmap.h" #include "gdkprivate.h" typedef struct diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c index 7973d8fc7e..5a17abd769 100644 --- a/gdk/x11/gdkproperty-x11.c +++ b/gdk/x11/gdkproperty-x11.c @@ -27,7 +27,8 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <string.h> -#include "gdk.h" + +#include "gdkproperty.h" #include "gdkprivate.h" GdkAtom diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 3ee2e43b3d..ebffc3579c 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -27,7 +27,9 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <string.h> -#include "gdk.h" + +#include "gdkproperty.h" +#include "gdkselection.h" #include "gdkprivate.h" #include "gdkx.h" diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c index a63ba55c6c..072ff456e5 100644 --- a/gdk/x11/gdkvisual-x11.c +++ b/gdk/x11/gdkvisual-x11.c @@ -26,10 +26,9 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> -#include "gdk.h" -#include "gdkprivate.h" -#include "gdkx.h" +#include "gdkvisual.h" +#include "gdkprivate.h" static void gdk_visual_add (GdkVisual *visual); static void gdk_visual_decompose_mask (gulong mask, diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 47b200c3e4..ddd5267eac 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -30,7 +30,9 @@ #include <netinet/in.h> #include "gdk.h" #include "config.h" -#include "gdkinput.h" + +#include "gdkwindow.h" +#include "gdkinputprivate.h" #include "gdkprivate.h" #include "MwmUtil.h" |