diff --git a/src/Makefile.am b/src/Makefile.am index c81d0963d..5f432724f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -127,6 +127,9 @@ libmutter_wayland_la_SOURCES = \ core/keybindings.c \ core/keybindings-private.h \ core/main.c \ + core/meta-cursor.c \ + core/meta-cursor.h \ + core/meta-cursor-private.h \ core/meta-cursor-tracker.c \ core/meta-cursor-tracker-private.h \ core/meta-idle-monitor.c \ diff --git a/src/core/meta-cursor-private.h b/src/core/meta-cursor-private.h new file mode 100644 index 000000000..14d3ec64e --- /dev/null +++ b/src/core/meta-cursor-private.h @@ -0,0 +1,38 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright 2013 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU 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 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * Author: Giovanni Campagna + */ + +#ifndef META_CURSOR_PRIVATE_H +#define META_CURSOR_PRIVATE_H + +#include "meta-cursor.h" + +#include +#include + +struct _MetaCursorReference { + int ref_count; + + CoglTexture2D *texture; + struct gbm_bo *bo; + int hot_x, hot_y; +}; + +#endif /* META_CURSOR_PRIVATE_H */ diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c index b2a619f3b..5c315fca6 100644 --- a/src/core/meta-cursor-tracker.c +++ b/src/core/meta-cursor-tracker.c @@ -45,20 +45,13 @@ #include #include +#include "meta-cursor-private.h" #include "meta-cursor-tracker-private.h" #include "screen-private.h" #include "monitor-private.h" #include "wayland/meta-wayland-private.h" -typedef struct { - int ref_count; - - CoglTexture2D *texture; - struct gbm_bo *bo; - int hot_x, hot_y; -} MetaCursorReference; - struct _MetaCursorTracker { GObject parent_instance; @@ -123,30 +116,6 @@ static void meta_cursor_tracker_set_crtc_has_hw_cursor (MetaCursorTracker *track gboolean has_hw_cursor); static void sync_cursor (MetaCursorTracker *tracker); -static MetaCursorReference * -meta_cursor_reference_ref (MetaCursorReference *self) -{ - g_assert (self->ref_count > 0); - self->ref_count++; - - return self; -} - -static void -meta_cursor_reference_unref (MetaCursorReference *self) -{ - self->ref_count--; - - if (self->ref_count == 0) - { - cogl_object_unref (self->texture); - if (self->bo) - gbm_bo_destroy (self->bo); - - g_slice_free (MetaCursorReference, self); - } -} - static void translate_meta_cursor (MetaCursor cursor, guint *glyph_out, diff --git a/src/core/meta-cursor.c b/src/core/meta-cursor.c new file mode 100644 index 000000000..822fd11d9 --- /dev/null +++ b/src/core/meta-cursor.c @@ -0,0 +1,48 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright 2013 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU 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 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * Author: Giovanni Campagna + */ + +#include "config.h" + +#include "meta-cursor-private.h" + +MetaCursorReference * +meta_cursor_reference_ref (MetaCursorReference *self) +{ + g_assert (self->ref_count > 0); + self->ref_count++; + + return self; +} + +void +meta_cursor_reference_unref (MetaCursorReference *self) +{ + self->ref_count--; + + if (self->ref_count == 0) + { + cogl_object_unref (self->texture); + if (self->bo) + gbm_bo_destroy (self->bo); + + g_slice_free (MetaCursorReference, self); + } +} diff --git a/src/core/meta-cursor.h b/src/core/meta-cursor.h new file mode 100644 index 000000000..6d5bc3ec3 --- /dev/null +++ b/src/core/meta-cursor.h @@ -0,0 +1,30 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright 2013 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU 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 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * Author: Giovanni Campagna + */ + +#ifndef META_CURSOR_H +#define META_CURSOR_H + +typedef struct _MetaCursorReference MetaCursorReference; + +MetaCursorReference * meta_cursor_reference_ref (MetaCursorReference *cursor); +void meta_cursor_reference_unref (MetaCursorReference *cursor); + +#endif /* META_CURSOR_H */