Example #1
0
void show_mouse_cursor()
{
  ASSERT(mouse_scares > 0);
  mouse_scares--;

  if (mouse_scares == 0)
    update_mouse_cursor();
}
Example #2
0
/**************************************************************************
  Stop waiting for any server network data.  See add_net_input().
**************************************************************************/
void remove_net_input(void)
{
    log_debug("Connection DOWN... ");
    net_socket = (-1);
    disable_focus_animation();
    draw_goto_patrol_lines = FALSE;
    update_mouse_cursor(CURSOR_DEFAULT);
}
Example #3
0
void set_mouse_cursor(CursorType type)
{
  if (mouse_cursor_type == type)
    return;

  mouse_cursor_type = type;
  update_mouse_cursor();
}
Example #4
0
void init_ani(Bit16u v1)
{

	signed short i;

	if (ds_readws(CURRENT_ANI) == -1)
		return;

	if ((v1 & 0x7f) != 2) {
		for (i = 0; i < 10; i++) {
			ds_writew(0xe260 + i * 2, 0);
			ds_writew(0xe24c + i * 2, 0xffff);
			ds_writew(0xe238 + i * 2, 1);
		}

		if (v1 & 0x80)
			ds_writeb(0x2cca, 0);
		else
			ds_writeb(0x2cca, 1);

		update_mouse_cursor();

		clear_ani_pal();

		/* set flag for pic_copy() */
		ds_writew(0x4a92, 1);

		/* set uppter left coordinates */
		ds_writew(0xc011, ds_readw(0xce41));
		ds_writew(0xc013, ds_readw(0xce3f));

		/* set lower right coordinates */
		ds_writew(0xc015, ds_readw(0xce41) + ds_readw(0xc3e7) - 1);
		ds_writew(0xc017, ds_readw(0xce3f) + ds_readb(0xc3ed) - 1);

		/* copy pointer */
		ds_writed(0xc019, ds_readd(ANI_MAIN_PTR));

		/* copy the main ani picture */
		do_pic_copy(1);

		set_ani_pal(Real2Host(ds_readd(0xce3b)));

		/* reset flag for pic_copy() */
		ds_writew(0x4a92, 0);

		refresh_screen_size();
	}

	if ((v1 & 0x7f) != 1) {
		wait_for_vsync();
		ds_writew(0x29ae, 1);
	}

	wait_for_vsync();
}
Example #5
0
void set_mouse_cursor(CursorType type, const Cursor* cursor)
{
  if (mouse_cursor_type == type &&
      mouse_cursor_custom == cursor)
    return;

  mouse_cursor_type = type;
  mouse_cursor_custom = cursor;
  update_mouse_cursor();
}
Example #6
0
/**************************************************************************
  This function will reset the mouse cursor if it leaves the map.
**************************************************************************/
gboolean leave_mapcanvas(GtkWidget *widget, GdkEventCrossing *event)
{
  if (gtk_notebook_get_current_page(GTK_NOTEBOOK(top_notebook))
      != gtk_notebook_page_num(GTK_NOTEBOOK(top_notebook), map_widget)) {
    /* Map is not currently topmost tab. Do not use tile specific cursors. */
    update_mouse_cursor(CURSOR_DEFAULT);
    return TRUE;
  }

  /* Bizarrely, this function can be called even when we don't "leave"
   * the map canvas, for instance, it gets called any time the mouse is
   * clicked. */
  if (map_exists()
      && event->x >= 0 && event->y >= 0
      && event->x < mapview.width && event->y < mapview.height) {
    control_mouse_cursor(canvas_pos_to_tile(event->x, event->y));
  } else {
    update_mouse_cursor(CURSOR_DEFAULT);
  }

  update_unit_info_label(get_units_in_focus());
  return TRUE;
}
Example #7
0
void
Controller::set_generic_brush(const GenericBrush& brush)
{
  // FIXME: Shouldn't allocate stuff outside of class
  delete client_draw_param->brush_buffer;
  client_draw_param->brush_buffer = brush.generate();
  brush_widget->set_brush(client_draw_param->brush_buffer);

  radius_slider->set_pos(int(client_draw_param->generic_brush.radius * 1000));
  spike_slider->set_pos(client_draw_param->generic_brush.spikes);
  hardness_slider->set_pos(int(client_draw_param->generic_brush.hardness * 1000));
  aspect_ratio_slider->set_pos(int(client_draw_param->generic_brush.aspect_ratio * 1000));
  angle_slider->set_pos(int(client_draw_param->generic_brush.angle * 1000));

  update_mouse_cursor();
}
Example #8
0
static gboolean
textview_motion_notify_event (GtkTextView *textview,
                              GdkEventMotion *event)
{
	gint x, y;

	g_return_val_if_fail (GTK_IS_TEXT_VIEW (textview), FALSE);

	gtk_text_view_window_to_buffer_coords (
		textview,
		GTK_TEXT_WINDOW_WIDGET,
		event->x, event->y, &x, &y);

	update_mouse_cursor (textview, x, y);

	return FALSE;
}
Example #9
0
static void
update_ctrl_state (GtkTextView *textview,
                   gboolean ctrl_is_down)
{
	GtkTextBuffer *buffer;
	gint x, y;

	buffer = gtk_text_view_get_buffer (textview);
	if (buffer) {
		if (((get_state (buffer) & E_BUFFER_TAGGER_STATE_CTRL_DOWN) != 0) != (ctrl_is_down != FALSE)) {
			update_state (buffer, E_BUFFER_TAGGER_STATE_CTRL_DOWN, ctrl_is_down != FALSE);
		}

		get_pointer_position (textview, &x, &y);
		gtk_text_view_window_to_buffer_coords (textview, GTK_TEXT_WINDOW_WIDGET, x, y, &x, &y);
		update_mouse_cursor (textview, x, y);
	}
}
Example #10
0
/**************************************************************************
  Main handler for mouse movement handling.
**************************************************************************/
static Uint16 main_mouse_motion_handler(SDL_MouseMotionEvent *pMotionEvent, void *pData)
{
    static struct widget *pWidget;
    struct tile *ptile;

    /* stop evaluating button hold time when moving to another tile in medium
     * hold state or above */
    if (button_behavior.counting && (button_behavior.hold_state >= MB_HOLD_MEDIUM)) {
        ptile = canvas_pos_to_tile(pMotionEvent->x, pMotionEvent->y);
        if (tile_index(ptile) != tile_index(button_behavior.ptile)) {
            button_behavior.counting = FALSE;
        }
    }

    if(draw_goto_patrol_lines) {
        update_line(pMotionEvent->x, pMotionEvent->y);
    }

#ifndef UNDER_CE
    if (gui_sdl_fullscreen) {
        check_scroll_area(pMotionEvent->x, pMotionEvent->y);
    }
#endif /* UNDER_CE */

    if ((pWidget = find_next_widget_at_pos(NULL,
                                           pMotionEvent->x,
                                           pMotionEvent->y)) != NULL) {
        update_mouse_cursor(CURSOR_DEFAULT);
        if (!(get_wstate(pWidget) == FC_WS_DISABLED)) {
            widget_sellected_action(pWidget);
        }
    } else {
        if (pSellected_Widget) {
            unsellect_widget_action();
        } else {
            control_mouse_cursor(canvas_pos_to_tile(pMotionEvent->x, pMotionEvent->y));
        }
    }

    draw_mouse_cursor();

    return ID_ERROR;
}
Example #11
0
static gboolean
textview_visibility_notify_event (GtkTextView *textview,
                                  GdkEventVisibility *event)
{
	gint wx, wy, bx, by;

	g_return_val_if_fail (GTK_IS_TEXT_VIEW (textview), FALSE);

	get_pointer_position (textview, &wx, &wy);

	gtk_text_view_window_to_buffer_coords (
		textview,
		GTK_TEXT_WINDOW_WIDGET,
		wx, wy, &bx, &by);

	update_mouse_cursor (textview, bx, by);

	return FALSE;
}
Example #12
0
void set_mouse_cursor_scale(const int newScale)
{
  mouse_cursor_scale = newScale;
  update_mouse_cursor();
}
Example #13
0
void set_use_native_cursors(bool state)
{
  use_native_mouse_cursor = state;
  update_mouse_cursor();
}
Example #14
0
/* Links can also be activated by clicking. */
static gboolean
textview_event_after (GtkTextView *textview,
                      GdkEvent *event)
{
	GtkTextIter start, end, iter;
	GtkTextBuffer *buffer;
	gint x, y;
	GdkModifierType mt = 0;
	guint event_button = 0;
	gdouble event_x_win = 0;
	gdouble event_y_win = 0;

	g_return_val_if_fail (GTK_IS_TEXT_VIEW (textview), FALSE);

	if (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) {
		guint event_keyval = 0;

		gdk_event_get_keyval (event, &event_keyval);

		switch (event_keyval) {
			case GDK_KEY_Control_L:
			case GDK_KEY_Control_R:
				update_ctrl_state (
					textview,
					event->type == GDK_KEY_PRESS);
				break;
		}

		return FALSE;
	}

	if (!gdk_event_get_state (event, &mt)) {
		GdkWindow *window;
		GdkDisplay *display;
		GdkDeviceManager *device_manager;
		GdkDevice *device;

		window = gtk_widget_get_parent_window (GTK_WIDGET (textview));
		display = gdk_window_get_display (window);
		device_manager = gdk_display_get_device_manager (display);
		device = gdk_device_manager_get_client_pointer (device_manager);

		gdk_window_get_device_position (window, device, NULL, NULL, &mt);
	}

	update_ctrl_state (textview, (mt & GDK_CONTROL_MASK) != 0);

	if (event->type != GDK_BUTTON_RELEASE)
		return FALSE;

	gdk_event_get_button (event, &event_button);
	gdk_event_get_coords (event, &event_x_win, &event_y_win);

	if (event_button != 1 || (mt & GDK_CONTROL_MASK) == 0)
		return FALSE;

	buffer = gtk_text_view_get_buffer (textview);

	/* we shouldn't follow a link if the user has selected something */
	gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
	if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
		return FALSE;

	gtk_text_view_window_to_buffer_coords (
		textview,
		GTK_TEXT_WINDOW_WIDGET,
		event_x_win, event_y_win, &x, &y);

	gtk_text_view_get_iter_at_location (textview, &iter, x, y);

	invoke_link_if_present (buffer, &iter);
	update_mouse_cursor (textview, x, y);

	return FALSE;
}