diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2017-07-10 23:27:12 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2017-07-10 23:27:12 +0000 |
| commit | dd25cf81bababb08e58e1fd5c83e80e7c7bb2363 (patch) | |
| tree | 31ae194a96c18cd00cb01b2914d80ebbe79d0ad4 | |
| parent | Drop obsolete SizeGroup::set_ignore_hidden (diff) | |
| download | inkscape-dd25cf81bababb08e58e1fd5c83e80e7c7bb2363.tar.gz inkscape-dd25cf81bababb08e58e1fd5c83e80e7c7bb2363.zip | |
Use new GdkSeat API and update gimpcolorwheel comments
| -rw-r--r-- | src/knot.cpp | 13 | ||||
| -rw-r--r-- | src/ui/widget/color-slider.cpp | 40 | ||||
| -rw-r--r-- | src/widgets/gimp/gimpcolorwheel.c | 32 | ||||
| -rw-r--r-- | src/widgets/gimp/gimpcolorwheel.h | 22 |
4 files changed, 73 insertions, 34 deletions
diff --git a/src/knot.cpp b/src/knot.cpp index 0f27c5581..ff21f534a 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -129,12 +129,23 @@ SPKnot::SPKnot(SPDesktop *desktop, gchar const *tip) SPKnot::~SPKnot() { auto display = gdk_display_get_default(); + +#if GTK_CHECK_VERSION(3,20,0) + auto seat = gdk_display_get_default_seat(display); + auto device = gdk_seat_get_pointer(seat); +#else auto dm = gdk_display_get_device_manager(display); auto device = gdk_device_manager_get_client_pointer(dm); - +#endif + if ((this->flags & SP_KNOT_GRABBED) && gdk_display_device_is_grabbed(display, device)) { // This happens e.g. when deleting a node in node tool while dragging it + +#if GTK_CHECK_VERSION(3,20,0) + gdk_seat_ungrab(seat); +#else gdk_device_ungrab(device, GDK_CURRENT_TIME); +#endif } if (this->_event_handler_id > 0) { diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index 2e665dbec..761f2e748 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -160,9 +160,28 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) ColorScales::setScaled(_adjustment->gobj(), CLAMP((gfloat)(event->x - cx) / cw, 0.0, 1.0)); signal_dragged.emit(); - gdk_device_grab( - gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)), _gdk_window->gobj(), GDK_OWNERSHIP_NONE, FALSE, - static_cast<GdkEventMask>(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), NULL, event->time); + auto window = _gdk_window->gobj(); + +#if GTK_CHECK_VERSION(3,20,0) + auto seat = gdk_event_get_seat(reinterpret_cast<GdkEvent *>(event)); + gdk_seat_grab(seat, + window, + GDK_SEAT_CAPABILITY_ALL_POINTING, + FALSE, + NULL, + reinterpret_cast<GdkEvent *>(event), + NULL, + NULL); +#else + auto device = gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)); + gdk_device_grab(device, + window, + GDK_OWNERSHIP_NONE, + FALSE, + static_cast<GdkEventMask>(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), + NULL, + event->time); +#endif } return false; @@ -171,9 +190,12 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) bool ColorSlider::on_button_release_event(GdkEventButton *event) { if (event->button == 1) { +#if GTK_CHECK_VERSION(3,20,0) + gdk_seat_ungrab(gdk_event_get_seat(reinterpret_cast<GdkEvent *>(event))); +#else gdk_device_ungrab(gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)), gdk_event_get_time(reinterpret_cast<GdkEvent *>(event))); - +#endif _dragging = false; signal_released.emit(); if (_value != _oldvalue) { @@ -518,3 +540,13 @@ static const guchar *sp_color_slider_render_map(gint x0, gint y0, gint width, gi return buf; } +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/widgets/gimp/gimpcolorwheel.c b/src/widgets/gimp/gimpcolorwheel.c index 212391497..e7ea6bf7b 100644 --- a/src/widgets/gimp/gimpcolorwheel.c +++ b/src/widgets/gimp/gimpcolorwheel.c @@ -7,20 +7,18 @@ * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+) * Michael Natterer <mitch@gimp.org> (ported back to GIMP) * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -381,7 +379,7 @@ hsv_to_rgb (gdouble *h, { *h = *v; *s = *v; - *v = *v; /* heh */ + /* *v = *v; -- heh */ } else { @@ -1242,7 +1240,7 @@ gimp_color_wheel_focus (GtkWidget *widget, * * Return value: A newly-created HSV color selector. * - * Since: 2.14 + * Since: 2.10 */ GtkWidget* gimp_color_wheel_new (void) @@ -1260,7 +1258,7 @@ gimp_color_wheel_new (void) * Sets the current color in an HSV color selector. * Color component values must be in the [0.0, 1.0] range. * - * Since: 2.14 + * Since: 2.10 */ void gimp_color_wheel_set_color (GimpColorWheel *wheel, @@ -1300,7 +1298,7 @@ gimp_color_wheel_set_color (GimpColorWheel *wheel, * Queries the current color in an HSV color selector. * Returned values will be in the [0.0, 1.0] range. * - * Since: 2.14 + * Since: 2.10 */ void gimp_color_wheel_get_color (GimpColorWheel *wheel, @@ -1326,7 +1324,7 @@ gimp_color_wheel_get_color (GimpColorWheel *wheel, * * Sets the ring fraction of a wheel color selector. * - * Since: GIMP 2.10 + * Since: 2.10 */ void gimp_color_wheel_set_ring_fraction (GimpColorWheel *hsv, @@ -1349,7 +1347,7 @@ gimp_color_wheel_set_ring_fraction (GimpColorWheel *hsv, * * Returns value: The ring fraction of the wheel color selector. * - * Since: GIMP 2.10 + * Since: 2.10 */ gdouble gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel) diff --git a/src/widgets/gimp/gimpcolorwheel.h b/src/widgets/gimp/gimpcolorwheel.h index 016fb593f..cec0f19df 100644 --- a/src/widgets/gimp/gimpcolorwheel.h +++ b/src/widgets/gimp/gimpcolorwheel.h @@ -5,21 +5,19 @@ * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code) * Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+) * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* |
