void gimp_tool_set_focus_display (GimpTool *tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display)); #ifdef DEBUG_FOCUS g_printerr ("%s: tool: %p display: %p focus_display: %p\n", G_STRFUNC, tool, display, tool->focus_display); #endif if (display != tool->focus_display) { if (tool->focus_display) { if (tool->active_modifier_state != 0) gimp_tool_set_active_modifier_state (tool, 0, tool->focus_display); if (tool->modifier_state != 0) gimp_tool_set_modifier_state (tool, 0, tool->focus_display); } tool->focus_display = display; } }
void gimp_tool_set_focus_display (GimpTool *tool, GimpDisplay *display) { g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display)); g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE); GIMP_LOG (TOOL_FOCUS, "tool: %p focus_display: %p tool->focus_display: %p", tool, display, tool->focus_display); if (display != tool->focus_display) { if (tool->focus_display) { if (tool->active_modifier_state != 0) { gimp_tool_control_activate (tool->control); gimp_tool_set_active_modifier_state (tool, 0, tool->focus_display); gimp_tool_control_halt (tool->control); } if (tool->modifier_state != 0) gimp_tool_set_modifier_state (tool, 0, tool->focus_display); } tool->focus_display = display; } }
void gimp_tool_button_release (GimpTool *tool, GimpCoords *coords, guint32 time, GdkModifierType state, GimpDisplay *display) { GimpButtonReleaseType release_type = GIMP_BUTTON_RELEASE_NORMAL; GimpCoords my_coords; g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (coords != NULL); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_object_ref (tool); my_coords = *coords; if (state & GDK_BUTTON3_MASK) { release_type = GIMP_BUTTON_RELEASE_CANCEL; } else if (gimp_tool_control_get_wants_click (tool->control)) { if (gimp_tool_check_click_distance (tool, coords, time, display)) { release_type = GIMP_BUTTON_RELEASE_CLICK; my_coords = tool->button_press_coords; /* synthesize a motion event back to the recorded press * coordinates */ GIMP_TOOL_GET_CLASS (tool)->motion (tool, &my_coords, time, state & GDK_BUTTON1_MASK, display); } else if (! tool->got_motion_event) { release_type = GIMP_BUTTON_RELEASE_NO_MOTION; } } GIMP_TOOL_GET_CLASS (tool)->button_release (tool, &my_coords, time, state, release_type, display); if (tool->active_modifier_state != 0) gimp_tool_set_active_modifier_state (tool, 0, display); tool->button_press_state = 0; g_object_unref (tool); }
void tool_manager_active_modifier_state_active (Gimp *gimp, GdkModifierType state, GimpDisplay *display) { GimpToolManager *tool_manager; g_return_if_fail (GIMP_IS_GIMP (gimp)); tool_manager = tool_manager_get (gimp); if (tool_manager->active_tool) { gimp_tool_set_active_modifier_state (tool_manager->active_tool, state, display); } }