/* If we get a ButtonPress event where the button is 4 or 5,
it's a Scroll event */
- if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5)
- {
+ switch (xevent->xbutton.button)
+ {
+ case 4: /* up */
+ case 5: /* down */
+ case 6: /* left */
+ case 7: /* right */
event->scroll.type = GDK_SCROLL;
- event->scroll.direction = (xevent->xbutton.button == 4) ?
- GDK_SCROLL_UP : GDK_SCROLL_DOWN;
+
+ if (xevent->xbutton.button == 4)
+ event->scroll.direction = GDK_SCROLL_UP;
+ else if (xevent->xbutton.button == 5)
+ event->scroll.direction = GDK_SCROLL_DOWN;
+ else if (xevent->xbutton.button == 6)
+ event->scroll.direction = GDK_SCROLL_LEFT;
+ else
+ event->scroll.direction = GDK_SCROLL_RIGHT;
+
event->scroll.window = window;
event->scroll.time = xevent->xbutton.x;
event->scroll.x = xevent->xbutton.x + xoffset;
event->scroll.y_root = (gfloat)xevent->xbutton.y_root;
event->scroll.state = (GdkModifierType) xevent->xbutton.state;
event->scroll.device = gdk_core_pointer;
- }
- else
- {
+ break;
+
+ default:
event->button.type = GDK_BUTTON_PRESS;
event->button.window = window;
event->button.time = xevent->xbutton.time;
event->button.device = gdk_core_pointer;
gdk_event_button_generate (event);
+ break;
}
break;
}
/* We treat button presses as scroll wheel events, so ignore the release */
- if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5)
+ if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5 ||
+ xevent->xbutton.button == 6 || xevent->xbutton.button ==7)
{
return_val = FALSE;
break;
xevent->xcrossing.subwindow));
/* Handle focusing (in the case where no window manager is running */
- if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
+ if (window &&
+ GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
xevent->xcrossing.detail != NotifyInferior &&
xevent->xcrossing.focus && !window_impl->has_focus)
{
xevent->xcrossing.detail, xevent->xcrossing.subwindow));
/* Handle focusing (in the case where no window manager is running */
- if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
+ if (window &&
+ GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
xevent->xcrossing.detail != NotifyInferior &&
xevent->xcrossing.focus && !window_impl->has_focus)
{
GDK_NOTE (EVENTS,
g_message ("focus in:\t\twindow: %ld", xevent->xfocus.window));
- if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
+ if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
{
gboolean had_focus = HAS_FOCUS (window_impl);
GDK_NOTE (EVENTS,
g_message ("focus out:\t\twindow: %ld", xevent->xfocus.window));
- if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
+ if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
{
gboolean had_focus = HAS_FOCUS (window_impl);
* an unmap, it means we hid the window ourselves, so we
* will have already flipped the iconified bit off.
*/
- if (GDK_WINDOW_IS_MAPPED (window))
+ if (window && GDK_WINDOW_IS_MAPPED (window))
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_ICONIFIED);
event->any.window = window;
/* Unset iconified if it was set */
- if (((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_ICONIFIED)
+ if (window && (((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_ICONIFIED))
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED,
0);
GdkWindow *win = event->any.window;
Window focus_win = GDK_WINDOW_IMPL_X11(((GdkWindowObject *)win)->impl)->focus_window;
- XSetInputFocus (GDK_WINDOW_XDISPLAY (win), focus_win,
- RevertToParent, xevent->xclient.data.l[1]);
+ /* There is no way of knowing reliably whether we are viewable so we need
+ * to trap errors so we don't cause a BadMatch.
+ */
+ gdk_error_trap_push ();
+ XSetInputFocus (GDK_WINDOW_XDISPLAY (win),
+ focus_win,
+ RevertToParent,
+ xevent->xclient.data.l[1]);
+ XSync (GDK_WINDOW_XDISPLAY (win), False);
+ gdk_error_trap_pop ();
}
else if ((Atom) xevent->xclient.data.l[0] == gdk_atom_intern ("_NET_WM_PING", FALSE))
{
const char *xsettings_name;
const char *gdk_name;
} settings_map[] = {
- { "Net/DoubleClickTime", "double-click-timeout" },
- { "Net/DragThreshold", "drag-threshold" }
+ { "Net/DoubleClickTime", "gtk-double-click-timeout" },
+ { "Net/DragThreshold", "gtk-drag-threshold" },
+ { "Gtk/ColorPalette", "gtk-color-palette" },
+ { "Gtk/ToolbarStyle", "gtk-toolbar-style" },
+ { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" },
+ { "Net/CursorBlink", "gtk-cursor-blink" },
+ { "Net/CursorBlinkTime", "gtk-cursor-blink-time" }
};
static void
XSettingsSetting *setting;
gboolean success = FALSE;
gint i;
+ GValue tmp_val = { 0, };
for (i = 0; i < G_N_ELEMENTS (settings_map) ; i++)
if (strcmp (settings_map[i].gdk_name, name) == 0)
case XSETTINGS_TYPE_INT:
if (check_transform (xsettings_name, G_TYPE_INT, G_VALUE_TYPE (value)))
{
- g_value_set_int (value, setting->data.v_int);
+ g_value_init (&tmp_val, G_TYPE_INT);
+ g_value_set_int (&tmp_val, setting->data.v_int);
+ g_value_transform (&tmp_val, value);
+
success = TRUE;
}
break;
case XSETTINGS_TYPE_STRING:
if (check_transform (xsettings_name, G_TYPE_STRING, G_VALUE_TYPE (value)))
{
- g_value_set_string (value, setting->data.v_string);
+ g_value_init (&tmp_val, G_TYPE_STRING);
+ g_value_set_string (&tmp_val, setting->data.v_string);
+ g_value_transform (&tmp_val, value);
+
success = TRUE;
}
break;
{
GdkColor color;
+ g_value_init (&tmp_val, GDK_TYPE_COLOR);
+
color.pixel = 0;
color.red = setting->data.v_color.red;
color.green = setting->data.v_color.green;
color.blue = setting->data.v_color.blue;
- g_value_set_boxed (value, &color);
+ g_value_set_boxed (&tmp_val, &color);
+
+ g_value_transform (&tmp_val, value);
success = TRUE;
}
break;
}
+
+ g_value_unset (&tmp_val);
xsettings_setting_free (setting);