#include "gdkinput.h"
#include "gdkprivate.h"
#include "MwmUtil.h"
-#include <stdlib.h>
-#include <stdio.h>
+
+#if HAVE_CONFIG_H
+# include <config.h>
+# if STDC_HEADERS
+# include <stdlib.h>
+# include <stdio.h>
+# include <string.h>
+# endif
+#else
+# include <stdlib.h>
+# include <stdio.h>
+#endif
+
#ifdef HAVE_SHAPE_EXT
#include <X11/extensions/shape.h>
#endif
-const int event_mask_table[20] =
+const int gdk_event_mask_table[20] =
{
ExposureMask,
PointerMotionMask,
0, /* PROXIMTY_OUT */
SubstructureNotifyMask
};
-const int nevent_masks = sizeof(event_mask_table)/sizeof(int);
+const int gdk_nevent_masks = sizeof(gdk_event_mask_table)/sizeof(int);
static gboolean gdk_window_have_shape_ext (void);
private->xdisplay = parent_display;
private->destroyed = FALSE;
+ private->mapped = FALSE;
private->resize_count = 0;
private->ref_count = 1;
xattributes_mask = 0;
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
xattributes.event_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
+ for (i = 0; i < gdk_nevent_masks; i++)
{
if (attributes->event_mask & (1 << (i + 1)))
- xattributes.event_mask |= event_mask_table[i];
+ xattributes.event_mask |= gdk_event_mask_table[i];
}
if (xattributes.event_mask)
private->ref_count = 1;
private->window_type = GDK_WINDOW_FOREIGN;
private->destroyed = FALSE;
+ private->mapped = (attrs.map_state != IsUnmapped);
private->extension_events = 0;
private->colormap = NULL;
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
+ private->mapped = TRUE;
XRaiseWindow (private->xdisplay, private->xwindow);
XMapWindow (private->xdisplay, private->xwindow);
}
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
- XUnmapWindow (private->xdisplay, private->xwindow);
+ {
+ private->mapped = FALSE;
+ XUnmapWindow (private->xdisplay, private->xwindow);
+ }
}
void
&attrs);
event_mask = 0;
- for (i = 0; i < nevent_masks; i++)
+ for (i = 0; i < gdk_nevent_masks; i++)
{
- if (attrs.your_event_mask & event_mask_table[i])
+ if (attrs.your_event_mask & gdk_event_mask_table[i])
event_mask |= 1 << (i + 1);
}
return;
xevent_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
+ for (i = 0; i < gdk_nevent_masks; i++)
{
if (event_mask & (1 << (i + 1)))
- xevent_mask |= event_mask_table[i];
+ xevent_mask |= gdk_event_mask_table[i];
}
XSelectInput (gdk_display, private->xwindow,
#endif
}
+/*************************************************************
+ * gdk_window_is_visible:
+ * Check if the given window is mapped.
+ * arguments:
+ * window:
+ * results:
+ * is the window mapped
+ *************************************************************/
+
+gboolean
+gdk_window_is_visible (GdkWindow *window)
+{
+ GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+
+ g_return_val_if_fail (window != NULL, FALSE);
+
+ return private->mapped;
+}
+
+/*************************************************************
+ * gdk_window_is_viewable:
+ * Check if the window and all ancestors of the window
+ * are mapped. (This is not necessarily "viewable" in
+ * the X sense, since we only check as far as we have
+ * GDK window parents, not to the root window)
+ * arguments:
+ * window:
+ * results:
+ * is the window viewable
+ *************************************************************/
+
+gboolean
+gdk_window_is_viewable (GdkWindow *window)
+{
+ GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+
+ g_return_val_if_fail (window != NULL, FALSE);
+
+ while (private && (private != &gdk_root_parent))
+ {
+ if (!private->mapped)
+ return FALSE;
+
+ private = (GdkWindowPrivate *)private->parent;
+ }
+
+ return TRUE;
+}
+
void
gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
g_dataset_set_data_full (drawable, key, data, destroy_func);
}
+