]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkspinner.c
Popdown the bubble window when text view is scrolled
[~andy/gtk] / gtk / gtkspinner.c
index e495603b0a07a9b8e7e05cf010c31791adae4341..06840c88fe441b6674fae97de6a8be4f074583c6 100644 (file)
@@ -14,9 +14,7 @@
  * Lesser 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.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  *
  * Code adapted from egg-spinner
  * by Christian Hergert <christian.hergert@gmail.com>
 
 #include "config.h"
 
-#include "gtkintl.h"
-#include "gtkaccessible.h"
-#include "gtkimage.h"
 #include "gtkspinner.h"
+
+#include "gtkimage.h"
+#include "gtkintl.h"
+#include "gtkstylecontext.h"
 #include "a11y/gtkspinneraccessible.h"
 
 
@@ -202,15 +201,19 @@ gtk_spinner_draw (GtkWidget *widget,
                   cairo_t   *cr)
 {
   GtkStyleContext *context;
-  GtkStateFlags state;
+  gint width, height;
+  gint size;
 
   context = gtk_widget_get_style_context (widget);
-  state = gtk_widget_get_state_flags (widget);
 
-  gtk_style_context_set_state (context, state);
-  gtk_render_activity (context, cr, 0, 0,
-                       gtk_widget_get_allocated_width (widget),
-                       gtk_widget_get_allocated_height (widget));
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+  size = MIN (width, height);
+
+  gtk_render_activity (context, cr,
+                       (width - size) / 2,
+                       (height - size) / 2,
+                       size, size);
 
   return FALSE;
 }