Skip to content

Commit

Permalink
Refactor object initialization
Browse files Browse the repository at this point in the history
- client/wayland: Make sure IBusWaylandIM->ibuscontext is NULL
  when IBusWaylandIM->context is NULL.

- configure: Set some default help messages.

- ui/gtk3: Make sure to call an error message if display is NULL.
  • Loading branch information
fujiwarat committed Dec 7, 2023
1 parent 719792d commit ac46d15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
10 changes: 6 additions & 4 deletions client/wayland/ibuswaylandim.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ struct wl_registry *_registry = NULL;

static gboolean _use_sync_mode = 1;

static void input_method_deactivate
(void *data,
struct zwp_input_method_v1 *input_method,
struct zwp_input_method_context_v1 *context);
static GObject *ibus_wayland_im_constructor (GType type,
guint n_params,
GObjectConstructParam
Expand Down Expand Up @@ -1207,10 +1211,8 @@ input_method_activate (void *data,

g_return_if_fail (IBUS_IS_WAYLAND_IM (wlim));
priv = ibus_wayland_im_get_instance_private (wlim);
if (priv->context) {
zwp_input_method_context_v1_destroy (priv->context);
priv->context = NULL;
}
if (priv->context)
input_method_deactivate (data, input_method, context);

priv->serial = 0;
priv->context = context;
Expand Down
18 changes: 9 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ AC_ARG_ENABLE(gtk4,
AS_HELP_STRING([--enable-gtk4],
[Build gtk4 im module]),
[enable_gtk4=$enableval],
[enable_gtk4=no]
[enable_gtk4=yes]
)
AM_CONDITIONAL([ENABLE_GTK4], [test x"$enable_gtk4" = x"yes"])

Expand Down Expand Up @@ -276,8 +276,7 @@ if test x"$enable_gtk2" = x"yes"; then

gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
else
enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
enable_gtk2="yes (enabled, use --disable-gtk2 to disable)"
fi

if test x"$enable_gtk3" = x"yes"; then
Expand All @@ -297,7 +296,6 @@ if test x"$enable_gtk3" = x"yes"; then
gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
else
enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
enable_gdk3_wayland=no
fi
if test x"$enable_gdk3_wayland" != x"yes"; then
Expand All @@ -313,8 +311,7 @@ if test x"$enable_gtk4" = x"yes"; then

gtk4_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk4`
GTK4_IM_MODULEDIR="$libdir"/gtk-4.0/$gtk4_binary_version/immodules
else
enable_gtk4="no (disabled, use --enable-gtk4 to enable)"
enable_gtk4="yes (enabled, use --disable-gtk4 to disable)"
fi

if test x"$enable_xim" = x"yes"; then
Expand All @@ -331,8 +328,10 @@ if test x"$enable_xim" = x"yes"; then
gtk+-2.0
])
fi
else
enable_xim="no (disabled, use --enable-xim to enable)"
enable_xim="yes (enabled, use --disable-xim to disable)"
fi
if test x"$enable_gtk3" = x"yes"; then
enable_gtk3="yes (enabled, use --disable-gtk3 to disable)"
fi

if $PKG_CONFIG --exists x11; then
Expand Down Expand Up @@ -363,8 +362,9 @@ if test x"$enable_wayland" = x"yes"; then
AC_SUBST(WAYLAND_PRTCLS_SUBDIR)
WAYLAND_SCANNER_RULES(['$(datadir)/$(WAYLAND_PRTCLS_SUBDIR)'])],
[AC_SUBST(wayland_scanner_rules)])
enable_wayland="yes (enabled, use --disable-wayland to disable)"
else
enable_wayland="no (disabled, use --enable-wayland to enable)"
wayland_scanner_rules="./wayland-scanner.mk"
AC_SUBST(wayland_scanner_rules)
fi

Expand Down
5 changes: 1 addition & 4 deletions ui/gtk3/panel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ class Panel : IBus.PanelService {
m_is_wayland_im = is_wayland_im;

#if USE_GDK_WAYLAND
var display = Gdk.Display.get_default();
Type instance_type = display.get_type();
Type wayland_type = typeof(GdkWayland.Display);
m_is_wayland = instance_type.is_a(wayland_type);
m_is_wayland = !BindingCommon.default_is_xdisplay();
#else
m_is_wayland = false;
warning("Checking Wayland is disabled");
Expand Down

0 comments on commit ac46d15

Please sign in to comment.