Index: src/x/xmousenu.c
===================================================================
--- src/x/xmousenu.c	(revision 11732)
+++ src/x/xmousenu.c	(working copy)
@@ -186,20 +186,28 @@
 static bool xmouse_set_mouse_xy(int x, int y)
 {
    ASSERT(xmouse_installed);
-   //FIXME
-   (void)x;
-   (void)y;
-#if 0
-   if ((x < 0) || (y < 0) || (x >= _xwin.window_width) || (y >= _xwin.window_height))
+
+   // TODO: Multi display warps.
+
+   ALLEGRO_SYSTEM_XGLX *system = (void *)al_system_driver();
+   Display *display = system->x11display;
+
+   int window_width = al_get_display_width();
+   int window_height = al_get_display_height();
+   if (x < 0 || y < 0 || x >= window_width || y >= window_height)
       return false;
 
-   _al_event_source_lock(&the_mouse.parent.es);
-   {
-      XWarpPointer(_xwin.display, _xwin.window, _xwin.window, 0, 0,
-                   _xwin.window_width, _xwin.window_height, x, y);
+   ALLEGRO_DISPLAY *win_disp = (void*)al_get_current_display();
+  
+   int new_x = x;
+   int new_y = y;
+   int dx = new_x - the_mouse.state.x;
+   int dy = new_y - the_mouse.state.y;
+
+   if (dx != 0 || dy != 0) {
+      XWarpPointer(display, None, None, 0, 0, 0, 0, dx, dy);
    }
-   _al_event_source_unlock(&the_mouse.parent.es);
-#endif
+
    return true;
 }
 
@@ -210,7 +218,8 @@
  */
 static bool xmouse_set_mouse_axis(int which, int z)
 {
-   ASSERT(xmouse_installed);
+   if (!xmouse_installed)
+      return;
 
    if (which != 2) {
       return false;
@@ -371,9 +380,10 @@
       return;
 
    _al_event_source_lock(&the_mouse.parent.es);
-   {
-      int dx = x - the_mouse.state.x;
-      int dy = y - the_mouse.state.y;
+   int dx = x - the_mouse.state.x;
+   int dy = y - the_mouse.state.y;
+
+   if (dx != 0 || dy != 0) {
       the_mouse.state.x = x;
       the_mouse.state.y = y;
 
Index: examples/ex_warp_mouse.c
===================================================================
--- examples/ex_warp_mouse.c	(revision 0)
+++ examples/ex_warp_mouse.c	(revision 0)
@@ -0,0 +1,59 @@
+#include <allegro5/allegro5.h>
+#include <allegro5/a5_font.h>
+
+int width = 640;
+int height = 480;
+
+int main()
+{
+   ALLEGRO_FONT *font;
+   ALLEGRO_DISPLAY *display;
+   ALLEGRO_EVENT_QUEUE *event_queue;
+
+   al_init();
+   al_font_init();
+   al_install_mouse();
+   al_install_keyboard();
+
+   al_set_new_display_flags(ALLEGRO_WINDOWED);
+   display = al_create_display(width, height);
+   al_show_mouse_cursor();
+
+   event_queue = al_create_event_queue();
+   al_register_event_source(event_queue, (void *)display);
+   al_register_event_source(event_queue, (void *)al_get_mouse());
+   al_register_event_source(event_queue, (void *)al_get_keyboard());
+
+   font = al_font_load_font("data/fixed_font.tga", NULL);
+
+   while (1) {
+      ALLEGRO_EVENT event;
+      al_wait_for_event(event_queue, &event);
+
+      if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
+         break;
+      }
+      if (event.type == ALLEGRO_EVENT_KEY_DOWN) {
+         if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
+            break;
+      }
+      if (event.type == ALLEGRO_EVENT_MOUSE_AXES) {
+         al_clear(al_map_rgb_f(0, 0, 0));
+         al_font_textprintf(font, 0, 0, "x: %i y: %i dx: %i dy %i",
+            event.mouse.x, event.mouse.y,
+            event.mouse.dx, event.mouse.dy);
+         al_font_textprintf_centre(font, width / 2,
+            (height - al_font_text_height(font)) / 2,
+            "Click to warp pointer to the middle.");
+         al_flip_display();
+      }
+      if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) {
+         al_set_mouse_xy(width / 2, height / 2);
+      }
+   }
+
+   al_destroy_event_queue(event_queue);
+   al_destroy_display(display);
+
+   return 0;
+}
Index: examples/CMakeLists.txt
===================================================================
--- examples/CMakeLists.txt	(revision 11732)
+++ examples/CMakeLists.txt	(working copy)
@@ -25,6 +25,7 @@
     example(ex_windows ${FONT_LINK_WITH})
     example(ex_disable_screensaver ${FONT_LINK_WITH})
     example(ex_blit ${FONT_LINK_WITH} ${COLOR_LINK_WITH})
+    example(ex_warp_mouse ${FONT_LINK_WITH})
 endif(SUPPORT_FONT)
 
 if(SUPPORT_IIO)
