gdkinternals.h 9.19 KB
Newer Older
1 2 3 4
/* 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
5
 * modify it under the terms of the GNU Lesser General Public
6 7 8 9 10 11
 * 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
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15 16 17 18 19 20
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
21
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22 23 24 25 26 27 28 29
 * 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/. 
 */

/* Uninstalled header defining types and functions internal to GDK */

#include <gdk/gdktypes.h>
30
#include <gdk/gdkwindow.h>
31 32 33 34 35 36 37 38 39 40 41
#include <gdk/gdkprivate.h>

#ifndef __GDK_INTERNALS_H__
#define __GDK_INTERNALS_H__

/**********************
 * General Facilities * 
 **********************/

/* Debugging support */

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
typedef struct _GdkColorInfo           GdkColorInfo;
typedef struct _GdkEventFilter	       GdkEventFilter;
typedef struct _GdkClientFilter	       GdkClientFilter;

typedef enum {
  GDK_COLOR_WRITEABLE = 1 << 0
} GdkColorInfoFlags;

struct _GdkColorInfo
{
  GdkColorInfoFlags flags;
  guint ref_count;
};

struct _GdkEventFilter {
  GdkFilterFunc function;
  gpointer data;
};

struct _GdkClientFilter {
  GdkAtom       type;
  GdkFilterFunc function;
  gpointer      data;
};

67 68 69 70
typedef enum {
  GDK_DEBUG_MISC          = 1 << 0,
  GDK_DEBUG_EVENTS        = 1 << 1,
  GDK_DEBUG_DND           = 1 << 2,
Jacob Berkman's avatar
Jacob Berkman committed
71 72
  GDK_DEBUG_XIM           = 1 << 3,
  GDK_DEBUG_NOGRABS       = 1 << 4,
73 74 75 76 77 78
  GDK_DEBUG_COLORMAP	  = 1 << 5,
  GDK_DEBUG_GDKRGB	  = 1 << 6,
  GDK_DEBUG_GC		  = 1 << 7,
  GDK_DEBUG_PIXMAP	  = 1 << 8,
  GDK_DEBUG_IMAGE	  = 1 << 9,
  GDK_DEBUG_INPUT	  = 1 <<10,
79 80
  GDK_DEBUG_CURSOR	  = 1 <<11,
  GDK_DEBUG_MULTIHEAD	  = 1 <<12
81 82
} GdkDebugFlag;

83 84 85 86 87 88 89 90 91 92 93
#ifndef GDK_DISABLE_DEPRECATED

typedef struct _GdkFontPrivate	       GdkFontPrivate;

struct _GdkFontPrivate
{
  GdkFont font;
  guint ref_count;
};

#endif /* GDK_DISABLE_DEPRECATED */
94

95 96 97 98 99 100
extern GList            *_gdk_default_filters;
extern GdkWindow  	*_gdk_parent_root;
extern gint		 _gdk_error_code;
extern gint		 _gdk_error_warnings;

extern guint _gdk_debug_flags;
101 102 103 104

#ifdef G_ENABLE_DEBUG

#define GDK_NOTE(type,action)		     G_STMT_START { \
105
    if (_gdk_debug_flags & GDK_DEBUG_##type)		    \
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
       { action; };			     } G_STMT_END

#else /* !G_ENABLE_DEBUG */

#define GDK_NOTE(type,action)

#endif /* G_ENABLE_DEBUG */

/* Arg parsing */

typedef enum 
{
  GDK_ARG_STRING,
  GDK_ARG_INT,
  GDK_ARG_BOOL,
  GDK_ARG_NOBOOL,
  GDK_ARG_CALLBACK
} GdkArgType;

typedef struct _GdkArgContext GdkArgContext;
typedef struct _GdkArgDesc GdkArgDesc;

typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);

struct _GdkArgContext
{
  GPtrArray *tables;
  gpointer cb_data;
};

struct _GdkArgDesc
{
  const char *name;
  GdkArgType type;
  gpointer location;
  GdkArgFunc callback;
};

/* Event handling */

146 147 148 149 150 151 152 153 154 155 156 157
typedef struct _GdkEventPrivate GdkEventPrivate;

typedef enum
{
  /* Following flag is set for events on the event queue during
   * translation and cleared afterwards.
   */
  GDK_EVENT_PENDING = 1 << 0
} GdkEventFlags;

struct _GdkEventPrivate
{
158 159 160
  GdkEvent   event;
  guint      flags;
  GdkScreen *screen;
161 162
};

163 164 165
extern GdkEventFunc   _gdk_event_func;    /* Callback for events */
extern gpointer       _gdk_event_data;
extern GDestroyNotify _gdk_event_notify;
166

167 168 169
extern GSList    *_gdk_displays;
extern gchar     *_gdk_display_name;

170 171
extern const GdkPointerHooks *_gdk_current_pointer_hooks;

172
GdkEvent* _gdk_event_new (void);
173 174


175 176
void      _gdk_events_queue  (GdkDisplay *display);
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
177

178 179 180 181 182 183 184 185 186 187 188
GList* _gdk_event_queue_find_first  (GdkDisplay *display);
void   _gdk_event_queue_remove_link (GdkDisplay *display,
				     GList      *node);
GList*  _gdk_event_queue_append     (GdkDisplay *display,
				     GdkEvent   *event);
void _gdk_event_button_generate     (GdkDisplay *display,
				     GdkEvent   *event);

void gdk_synthesize_window_state (GdkWindow     *window,
                                  GdkWindowState unset_flags,
                                  GdkWindowState set_flags);
189

190 191 192
#define GDK_SCRATCH_IMAGE_WIDTH 256
#define GDK_SCRATCH_IMAGE_HEIGHT 64

193 194
GdkImage* _gdk_image_new_for_depth (GdkScreen    *screen,
				    GdkImageType  type,
195 196 197 198
				    GdkVisual    *visual,
				    gint          width,
				    gint          height,
				    gint          depth);
199 200 201 202 203 204
GdkImage *_gdk_image_get_scratch (GdkScreen *screen,
				  gint	     width,
				  gint	     height,
				  gint	     depth,
				  gint	    *x,
				  gint	    *y);
205 206 207 208 209 210 211 212 213 214

GdkImage *_gdk_drawable_copy_to_image (GdkDrawable  *drawable,
				       GdkImage     *image,
				       gint          src_x,
				       gint          src_y,
				       gint          dest_x,
				       gint          dest_y,
				       gint          width,
				       gint          height);

215 216 217 218
/*************************************
 * Interfaces used by windowing code *
 *************************************/

Owen Taylor's avatar
Owen Taylor committed
219 220 221
void       _gdk_window_destroy           (GdkWindow   *window,
					  gboolean     foreign_destroy);
void       _gdk_window_clear_update_area (GdkWindow   *window);
222 223

void       _gdk_screen_close             (GdkScreen   *screen);
224

225 226
const char *_gdk_get_sm_client_id (void);

227 228 229 230 231 232 233 234 235 236 237 238 239
/*****************************************
 * Interfaces provided by windowing code *
 *****************************************/

/* Font/string functions implemented in module-specific code */
gint _gdk_font_strlen (GdkFont *font, const char *str);
void _gdk_font_destroy (GdkFont *font);

void _gdk_colormap_real_destroy (GdkColormap *colormap);

void _gdk_cursor_destroy (GdkCursor *cursor);

extern GdkArgDesc _gdk_windowing_args[];
240 241 242
void     _gdk_windowing_init                    (gint       *argc,
                                                 gchar    ***argv);
void     _gdk_windowing_set_default_display     (GdkDisplay *display);
243

244 245 246 247 248 249 250 251 252 253 254 255 256 257
void     _gdk_windowing_window_get_offsets      (GdkWindow  *window,
						 gint       *x_offset,
						 gint       *y_offset);
void     _gdk_windowing_window_clear_area       (GdkWindow  *window,
						 gint        x,
						 gint        y,
						 gint        width,
						 gint        height);
void     _gdk_windowing_window_clear_area_e     (GdkWindow  *window,
						 gint        x,
						 gint        y,
						 gint        width,
						 gint        height);

258 259
GdkWindow* _gdk_windowing_window_at_pointer  (GdkScreen       *screen,
                                              gint            *win_x,
260 261 262 263 264 265
					      gint            *win_y);
GdkWindow* _gdk_windowing_window_get_pointer (GdkWindow       *window,
					      gint            *x,
					      gint            *y,
					      GdkModifierType *mask);

266 267 268
/* Return the number of bits-per-pixel for images of the specified depth. */
gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
					gint        depth);
269

Havoc Pennington's avatar
Havoc Pennington committed
270 271
#define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)

272 273 274 275 276 277 278 279 280
/* Called before processing updates for a window. This gives the windowing
 * layer a chance to save the region for later use in avoiding duplicate
 * exposes. The return value indicates whether the function has a saved
 * the region; if the result is TRUE, then the windowing layer is responsible
 * for destroying the region later.
 */
gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow  *window,
						 GdkRegion  *area);

Owen Taylor's avatar
Owen Taylor committed
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
/* Called to do the windowing system specific part of gdk_window_destroy(),
 *
 * window: The window being destroyed
 * recursing: If TRUE, then this is being called because a parent
 *            was destroyed. This generally means that the call to the windowing system
 *            to destroy the window can be omitted, since it will be destroyed as a result
 *            of the parent being destroyed. Unless @foreign_destroy
 *            
 * foreign_destroy: If TRUE, the window or a parent was destroyed by some external 
 *            agency. The window has already been destroyed and no windowing
 *            system calls should be made. (This may never happen for some
 *            windowing systems.)
 */
void _gdk_windowing_window_destroy (GdkWindow *window,
				    gboolean   recursing,
				    gboolean   foreign_destroy);

298 299 300
void _gdk_windowing_display_set_sm_client_id (GdkDisplay  *display,
					      const gchar *sm_client_id);

301
/* Implementation types */
Elliot Lee's avatar
Elliot Lee committed
302 303
GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
304

305 306 307 308
/************************************
 * Initialization and exit routines *
 ************************************/

309 310
void _gdk_image_exit  (void);
void _gdk_windowing_exit (void);
311

312 313 314
void _gdk_get_command_line_args (int    *argc,
				 char ***argv);

315 316 317 318 319
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __GDK_INTERNALS_H__ */