* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#include "../config.h"
#endif
-#define OTHER_XEVENT_BUFSIZE 4
-static XEvent other_xevent[OTHER_XEVENT_BUFSIZE]; /* XEvents passed along to user */
-static int other_xevent_i = 0;
static GList *putback_events = NULL;
static gulong base_id;
for (i = 1; i < *argc;)
{
#ifdef G_ENABLE_DEBUG
- if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
+ if ((strcmp ("--gdk-debug", (*argv)[i]) == 0) ||
+ (strncmp ("--gdk-debug=", (*argv)[i], 12) == 0))
{
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
+ gchar *equal_pos = strchr ((*argv)[i], '=');
+
+ if (equal_pos != NULL)
+ {
+ gdk_debug_flags |= g_parse_debug_string (equal_pos+1,
+ gdk_debug_keys,
+ gdk_ndebug_keys);
+ }
+ else if ((i + 1) < *argc && (*argv)[i + 1])
{
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
gdk_debug_keys,
gdk_ndebug_keys);
- (*argv)[i + 1] = NULL;
+ (*argv)[i] = NULL;
i += 1;
}
+ (*argv)[i] = NULL;
}
- else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
+ else if ((strcmp ("--gdk-no-debug", (*argv)[i]) == 0) ||
+ (strncmp ("--gdk-no-debug=", (*argv)[i], 15) == 0))
{
- (*argv)[i] = NULL;
+ gchar *equal_pos = strchr ((*argv)[i], '=');
- if ((i + 1) < *argc && (*argv)[i + 1])
+ if (equal_pos != NULL)
+ {
+ gdk_debug_flags &= ~g_parse_debug_string (equal_pos+1,
+ gdk_debug_keys,
+ gdk_ndebug_keys);
+ }
+ else if ((i + 1) < *argc && (*argv)[i + 1])
{
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
gdk_debug_keys,
gdk_ndebug_keys);
- (*argv)[i + 1] = NULL;
+ (*argv)[i] = NULL;
i += 1;
}
+ (*argv)[i] = NULL;
}
else
#endif /* G_ENABLE_DEBUG */
*/
gchar*
-gdk_set_locale ()
+gdk_set_locale (void)
{
if (!setlocale (LC_ALL,""))
g_print ("locale not supported by C library\n");
*/
gint
-gdk_events_pending ()
+gdk_events_pending (void)
{
gint result;
GList *tmp_list;
}
gint
-gdk_get_show_events ()
+gdk_get_show_events (void)
{
return gdk_debug_flags & GDK_DEBUG_EVENTS;
}
gint
-gdk_get_use_xshm ()
+gdk_get_use_xshm (void)
{
return gdk_use_xshm;
}
*/
guint32
-gdk_time_get ()
+gdk_time_get (void)
{
struct timeval end;
struct timeval elapsed;
*/
guint32
-gdk_timer_get ()
+gdk_timer_get (void)
{
return timer_val;
}
}
void
-gdk_timer_enable ()
+gdk_timer_enable (void)
{
timerp = &timer;
}
void
-gdk_timer_disable ()
+gdk_timer_disable (void)
{
timerp = NULL;
}
*/
gint
-gdk_screen_width ()
+gdk_screen_width (void)
{
gint return_val;
*/
gint
-gdk_screen_height ()
+gdk_screen_height (void)
{
gint return_val;
}
void
-gdk_key_repeat_disable ()
+gdk_key_repeat_disable (void)
{
XAutoRepeatOff (gdk_display);
}
void
-gdk_key_repeat_restore ()
+gdk_key_repeat_restore (void)
{
if (autorepeat)
XAutoRepeatOn (gdk_display);
*--------------------------------------------------------------
*/
-void gdk_flush ()
+void gdk_flush (void)
{
XSync (gdk_display, False);
}
void
-gdk_beep ()
+gdk_beep (void)
{
XBell(gdk_display, 100);
}
*/
static gint
-gdk_event_wait ()
+gdk_event_wait (void)
{
GList *list;
GdkInput *input;
GdkWindow *window;
GdkWindowPrivate *window_private;
- XComposeStatus compose;
+ static XComposeStatus compose;
+ KeySym keysym;
int charcount;
#ifdef USE_XIM
static gchar* buf = NULL;
buf_len = 128;
buf = g_new (gchar, buf_len);
}
+ keysym = GDK_VoidSymbol;
+
if (xim_using == TRUE && xim_ic)
{
Status status;
/* Clear keyval. Depending on status, may not be set */
- event->key.keyval = GDK_VoidSymbol;
charcount = XmbLookupString(xim_ic->xic,
&xevent->xkey, buf, buf_len-1,
- (KeySym*) &event->key.keyval,
- &status);
+ &keysym, &status);
if (status == XBufferOverflow)
{ /* retry */
/* alloc adequate size of buffer */
charcount = XmbLookupString (xim_ic->xic,
&xevent->xkey, buf, buf_len-1,
- (KeySym*) &event->key.keyval,
- &status);
+ &keysym, &status);
}
if (status == XLookupNone)
{
}
else
charcount = XLookupString (&xevent->xkey, buf, buf_len,
- (KeySym*) &event->key.keyval,
- &compose);
+ &keysym, &compose);
#else
charcount = XLookupString (&xevent->xkey, buf, 16,
- (KeySym*) &event->key.keyval,
- &compose);
+ &keysym, &compose);
#endif
+ event->key.keyval = keysym;
+
if (charcount > 0 && buf[charcount-1] == '\0')
charcount --;
else
case KeyRelease:
/* Lookup the string corresponding to the given keysym.
*/
+ keysym = GDK_VoidSymbol;
charcount = XLookupString (&xevent->xkey, buf, 16,
- (KeySym*) &event->key.keyval,
- &compose);
+ &keysym, &compose);
+ event->key.keyval = keysym;
/* Print debugging info.
*/
window_private->dnd_drag_savedeventmask = dnd_winattr.your_event_mask;
dnd_setwinattr.event_mask =
- window_private->dnd_drag_eventmask = ButtonMotionMask |
- EnterWindowMask | LeaveWindowMask;
+ window_private->dnd_drag_eventmask = ButtonMotionMask | ButtonPressMask | ButtonReleaseMask |
+ EnterWindowMask | LeaveWindowMask | ExposureMask;
XChangeWindowAttributes(gdk_display, window_private->xwindow,
CWEventMask, &dnd_setwinattr);
}
ButtonMotionMask | PointerMotionMask |
/* PointerMotionHintMask | */ /* HINTME */
ButtonPressMask | ButtonReleaseMask,
- GrabModeAsync, GrabModeAsync, gdk_root_window,
+ GrabModeAsync, GrabModeAsync, None,
None, CurrentTime);
#ifdef G_ENABLE_DEBUG
GDK_NOTE(DND, g_print("xgpret = %d\n", xgpret));
while ((XPending (gdk_display) > 0) &&
XCheckTypedWindowEvent(gdk_display, xevent->xany.window,
ConfigureNotify, xevent))
- GDK_NOTE (EVENTS,
- g_print ("configure notify discarded:\twindow: %ld\n",
- xevent->xconfigure.window - base_id));
- /*XSync (gdk_display, 0);*/
+ {
+ GdkFilterReturn result;
+
+ GDK_NOTE (EVENTS,
+ g_print ("configure notify discarded:\twindow: %ld\n",
+ xevent->xconfigure.window - base_id));
+
+ result = gdk_event_apply_filters (xevent, event,
+ window_private
+ ?window_private->filters
+ :gdk_default_filters);
+
+ /* If the result is GDK_FILTER_REMOVE, there will be
+ * trouble, but anybody who filtering the Configure events
+ * better know what they are doing
+ */
+ if (result != GDK_FILTER_CONTINUE)
+ {
+ return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
+ }
+
+ /*XSync (gdk_display, 0);*/
+ }
+
GDK_NOTE (EVENTS,
g_print ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d\n",
gdk_input_vtable.other_event)
return_val = gdk_input_vtable.other_event(event, xevent, window);
else
- return_val = -1;
+ return_val = FALSE;
- if (return_val < 0) /* not an XInput event, convert */
- {
- event->other.type = GDK_OTHER_EVENT;
- event->other.window = window;
- event->other.xevent = (GdkXEvent *)&other_xevent[other_xevent_i];
- memcpy (&other_xevent[other_xevent_i], xevent, sizeof (XEvent));
- other_xevent_i = (other_xevent_i+1) % OTHER_XEVENT_BUFSIZE;
- return_val = TRUE;
- }
- else
- return_val = return_val && !window_private->destroyed;
+ return_val = return_val && !window_private->destroyed;
break;
}
*/
static void
-gdk_exit_func ()
+gdk_exit_func (void)
{
static gboolean in_gdk_exit_func = FALSE;
static void
gdk_dnd_drag_begin (GdkWindow *initial_window)
{
- GdkEventDragBegin tev;
+ GdkEvent tev;
GDK_NOTE(DND, g_print("------- STARTING DRAG from %p\n", initial_window));
tev.type = GDK_DRAG_BEGIN;
- tev.window = initial_window;
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
+ tev.dragbegin.window = initial_window;
+ tev.dragbegin.u.allflags = 0;
+ tev.dragbegin.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- gdk_event_put ((GdkEvent *) &tev);
+ gdk_event_put (&tev);
}
static void
GdkPoint coords)
{
GdkWindowPrivate *wp;
- GdkEventDragRequest tev;
+ GdkEvent tev;
int i;
- tev.type = GDK_DRAG_REQUEST;
- tev.drop_coords = coords;
- tev.requestor = dest;
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tev.isdrop = 1;
+ tev.dragrequest.type = GDK_DRAG_REQUEST;
+ tev.dragrequest.drop_coords = coords;
+ tev.dragrequest.requestor = dest;
+ tev.dragrequest.u.allflags = 0;
+ tev.dragrequest.u.flags.protocol_version = DND_PROTOCOL_VERSION;
+ tev.dragrequest.isdrop = 1;
for (i = 0; i < gdk_dnd.drag_numwindows; i++)
{
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
if (wp->dnd_drag_accepted)
{
- tev.window = (GdkWindow *) wp;
- tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
- tev.timestamp = gdk_dnd.last_drop_time;
- tev.data_type =
+ tev.dragrequest.window = (GdkWindow *) wp;
+ tev.dragrequest.u.flags.delete_data = wp->dnd_drag_destructive_op;
+ tev.dragrequest.timestamp = gdk_dnd.last_drop_time;
+ tev.dragrequest.data_type =
gdk_atom_name(wp->dnd_drag_data_type);
- gdk_event_put((GdkEvent *) &tev);
+ gdk_event_put(&tev);
}
}
}
if (realfmt != (sizeof(Atom) * 8))
{
- g_warning("XdeTypelist property had format of %d instead of the expected %d, on window %#lx\n",
- realfmt, sizeof(Atom) * 8, xevent->xclient.data.l[0]);
+ g_warning("XdeTypelist property had format of %d instead of the expected %ld, on window %#lx\n",
+ realfmt, (glong)sizeof(Atom) * 8, xevent->xclient.data.l[0]);
return 0;
}