Ejemplo n.º 1
0
void
Canvas::ComputeBounds ()
{
	Surface *surface = GetDeployment ()->GetSurface ();
	Panel::ComputeBounds ();
	coverage_bounds = bounds;
	if (surface && IsAttached () && surface->IsTopLevel (this)) {
		// toplevel canvas don't subscribe to the same bounds computation as others
		bounds = extents = Rect (0, 0, surface->GetWindow()->GetWidth(), surface->GetWindow()->GetHeight());
		bounds_with_children = extents_with_children = Rect (0, 0, surface->GetWindow()->GetWidth(), surface->GetWindow()->GetHeight());

		ComputeGlobalBounds ();
		ComputeSurfaceBounds ();
	}
}
Ejemplo n.º 2
0
static GtkWindow *
get_top_level_widget (Deployment *deployment = NULL)
{
    if (!deployment)
        deployment = Deployment::GetCurrent ();

    Surface *surface = deployment->GetSurface ();
    if (!surface)
        return NULL;

    MoonWindow *window = surface->GetWindow ();
    if (!window)
        return NULL;

    GtkWidget *widget = ((MoonWindowGtk *) window)->GetWidget ();
    GtkWidget *top_level = gtk_widget_get_toplevel (widget);
    // a "windowless==true" won't provide a GtkWindow for top_level
    if (!GTK_IS_WINDOW (top_level)) {
        // so we need to query it from FF (well hidden) using the GdkWindow we can get from the plugin
        gpointer user_data = NULL;
        gdk_window_get_user_data (GDK_WINDOW (window->GetPlatformWindow ()), &user_data);
        if (user_data)
            top_level = GTK_WIDGET (user_data);
    }

    return GTK_IS_WINDOW (top_level) ? (GtkWindow *) top_level : NULL;
}