Ejemplo n.º 1
0
GtkStyleContext*
ClaimStyleContext(WidgetNodeType aNodeType, GtkTextDirection aDirection,
                  GtkStateFlags aStateFlags, StyleFlags aFlags)
{
  MOZ_ASSERT(!sStyleContextNeedsRestore);
  GtkStyleContext* style = GetStyleInternal(aNodeType);
#ifdef DEBUG
  MOZ_ASSERT(!sCurrentStyleContext);
  sCurrentStyleContext = style;
#endif
  GtkStateFlags oldState = gtk_style_context_get_state(style);
  GtkTextDirection oldDirection = gtk_style_context_get_direction(style);
  if (oldState != aStateFlags || oldDirection != aDirection) {
    // From GTK 3.8, set_state() will overwrite the direction, so set
    // direction after state.
    gtk_style_context_set_state(style, aStateFlags);
    gtk_style_context_set_direction(style, aDirection);

    // This invalidate is necessary for unsaved style contexts from GtkWidgets
    // in pre-3.18 GTK, because automatic invalidation of such contexts
    // was delayed until a resize event runs.
    //
    // https://bugzilla.mozilla.org/show_bug.cgi?id=1272194#c7
    //
    // Avoid calling invalidate on saved contexts to avoid performing
    // build_properties() (in 3.16 stylecontext.c) unnecessarily early.
    if (!sStyleContextNeedsRestore) {
      gtk_style_context_invalidate(style);
    }
  }
  return style;
}
Ejemplo n.º 2
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkStyleContext_gtk_1style_1context_1set_1direction
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _direction
)
{
	GtkStyleContext* self;
	GtkTextDirection direction;

	// convert parameter self
	self = (GtkStyleContext*) _self;

	// convert parameter direction
	direction = (GtkTextDirection) _direction;

	// call function
	gtk_style_context_set_direction(self, direction);

	// cleanup parameter self

	// cleanup parameter direction
}