Example #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;
}
Example #2
0
JNIEXPORT jint JNICALL
Java_org_gnome_gtk_GtkStyleContext_gtk_1style_1context_1get_1direction
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	GtkTextDirection result;
	jint _result;
	GtkStyleContext* self;

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

	// call function
	result = gtk_style_context_get_direction(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jint) result;

	// and finally
	return _result;
}