/* Check if both monitors are the same */ gboolean xfdashboard_window_tracker_monitor_is_equal(XfdashboardWindowTrackerMonitor *inLeft, XfdashboardWindowTrackerMonitor *inRight) { gint leftIndex, rightIndex; g_return_val_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_MONITOR(inLeft), FALSE); g_return_val_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_MONITOR(inRight), FALSE); /* Check if both are the same workspace or refer to same one */ leftIndex=xfdashboard_window_tracker_monitor_get_number(inLeft); rightIndex=xfdashboard_window_tracker_monitor_get_number(inRight); if(inLeft==inRight || leftIndex==rightIndex) return(TRUE); /* If we get here then they cannot be considered equal */ return(FALSE); }
/* Monitor size changed */ static void _xfdashboard_stage_interface_on_geometry_changed(XfdashboardStageInterface *self, gpointer inUserData) { XfdashboardStageInterfacePrivate *priv; gint x, y, w, h; g_return_if_fail(XFDASHBOARD_IS_STAGE_INTERFACE(self)); priv=self->priv; /* Resize actor to new monitor */ xfdashboard_window_tracker_monitor_get_geometry(priv->monitor, &x, &y, &w, &h); clutter_actor_set_position(CLUTTER_ACTOR(self), x, y); clutter_actor_set_size(CLUTTER_ACTOR(self), w, h); XFDASHBOARD_DEBUG(self, ACTOR, "Stage interface moved to %d,%d and resized to %dx%d because %s monitor %d changed geometry", x, y, w, h, xfdashboard_window_tracker_monitor_is_primary(priv->monitor) ? "primary" : "non-primary", xfdashboard_window_tracker_monitor_get_number(priv->monitor)); }
/* Monitor changed primary state */ static void _xfdashboard_stage_interface_on_primary_changed(XfdashboardStageInterface *self, gpointer inUserData) { XfdashboardStageInterfacePrivate *priv; gboolean isPrimary; g_return_if_fail(XFDASHBOARD_IS_STAGE_INTERFACE(self)); priv=self->priv; /* Get new primary state of monitor */ isPrimary=xfdashboard_window_tracker_monitor_is_primary(priv->monitor); /* Depending on primary state set CSS class */ if(isPrimary) xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(self), "primary-monitor"); else xfdashboard_stylable_remove_class(XFDASHBOARD_STYLABLE(self), "primary-monitor"); XFDASHBOARD_DEBUG(self, ACTOR, "Stage interface changed primary state to %s because of monitor %d", xfdashboard_window_tracker_monitor_is_primary(priv->monitor) ? "primary" : "non-primary", xfdashboard_window_tracker_monitor_get_number(priv->monitor)); }