diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-01-22 11:15:05 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-01-22 11:15:31 -0800 |
commit | 7c3d742c357dd6480e813f067435b324dba2b325 (patch) | |
tree | 6b393225ad885e16e829a96d070cd94ab0171ac9 /src/emacsgtkfixed.c | |
parent | 7bf54d01159eb09bae3c9cd86f2af0812d9afdf6 (diff) | |
download | emacs-7c3d742c357dd6480e813f067435b324dba2b325.tar.gz |
xwidgets style cleanup
Adjust the newly-added Xwidgets code so that it uses a more-typical
Emacs style. This should not affect behavior, except that in
a few places it adds runtime checks that Lisp arguments are of
the proper type, and in one place it uses more-precise arithmetic.
* src/buffer.c, src/dispnew.c, src/emacs.c, src/emacsgtkfixed.c:
* src/emacs.c, src/print.c, src/window.c, src/xdisp.c, src/xterm.c:
Include xwidget.h unconditionally.
* src/buffer.c (Fkill_buffer):
* src/dispnew.c (update_window):
* src/emacs.c (main):
* src/print.c (print_object):
* src/window.c (Fdelete_window_internal):
* src/xdisp.c (handle_single_display_spec, push_it, pop_it)
(get_next_element, set_iterator_to_next, next_element_from_xwidget)
(dump_glyph, calc_pixel_width_or_height, BUILD_GLYPH_STRINGS_XW)
(BUILD_GLYPH_STRINGS, x_produce_glyphs, get_window_cursor_type):
* src/xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
Call xwidget functions and macros without worrying about
HAVE_XWIDGETS when the code is a no-op on non-xwidget
platforms.
* src/dispextern.h (XWIDGET_GLYPH, struct glyph_string.xwidget)
(IT_XWIDGET, GET_FROM_XWIDGET, struct it.u.xwidget)
(struct it.xwidget):
* src/lisp.h (PVEC_XWIDGET, PVEC_XWIDGET_VIEW):
Always define.
* src/emacsgtkfixed.h: Omit unnecessary comment.
* src/keyboard.c: Fix spacing.
* src/xdisp.c (BUILD_XWIDGET_GLYPH_STRING, produce_xwidget_glyph):
Define to be a no-op if not HAVE_XWIDGETS.
* src/xwidget.c: Include xwidget.h first (after config.h)
to make sure that it can stand by itself.
(Fmake_xwidget, Fxwidget_webkit_execute_script):
Fix typo in doc string.
(Fmake_xwidget): Check type of args.
(Fmake_xwidget, offscreen_damage_event)
(webkit_document_load_finished_cb, webkit_download_cb)
(webkit_new_window_policy_decision_requested_cb)
(webkit_navigation_policy_decision_requested_cb)
(xwidget_osr_draw_cb, xwidget_osr_event_forward)
(xwidget_osr_event_set_embedder, xwidget_init_view):
Omit unnecessary casts.
* src/xwidget.c (Fmake_xwidget, xwidget_hidden)
(xwidget_show_view, xwidget_hide_view)
(x_draw_xwidget_glyph_string, xwidget_start_redisplay, xwidget_touch)
(xwidget_touched):
* src/xwidget.h (struct xwidget.kill_without_query)
(struct xwidget_view.redisplayed, struct xwidget_view.hidden):
Use bool for boolean.
* src/xwidget.c (store_xwidget_event_string, Fxwidget_size_request):
Simplify by using list functions.
(WEBKIT_FN_INIT): Omit unnecessary test for nil.
(Fxwidget_resize): Check type of integer args
before doing any work. Check that they are nonnegative.
(Fxwidget_set_adjustment): Check type of integer arg.
Avoid redundant call to gtk_scrolled_window_get_vadjustment.
Simplify. Use double, not float.
(Fxwidget_info, Fxwidget_view_info): Simplify by using CALLN.
(valid_xwidget_spec_p): Simplify.
(xwidget_spec_value): Omit unused arg FOUND. All callers changed.
* src/xwidget.h: Include lisp.h first, so that includers do
not need to worry about doing that before including this file.
Make this .h file safe to include even on non-HAVE_XWIDGETS
configurations, to simplify the includers.
(x_draw_xwidget_glyph_string, syms_of_xwidget, valid_xwidget_spec_p)
(xwidget_end_redisplay, lookup_xwidget)
(xwidget_view_delete_all_in_window, kill_buffer_xwidgets):
Now a no-op if !HAVE_XWIDGETS, to simplify callers.
(struct glyph_matrix, struct glyph_string, struct xwidget)
(struct xwidget_view, struct window):
New forward or incomplete decls, so that includers need not
assume the corresponding .h files are already included, or that
HAVE_XWIDGETS is defined.
(struct xwidget_type, xwidget_from_id): Remove; unused.
Diffstat (limited to 'src/emacsgtkfixed.c')
-rw-r--r-- | src/emacsgtkfixed.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index 08b840389c5..6795155831e 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c @@ -23,9 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" #include "frame.h" #include "xterm.h" -#ifdef HAVE_XWIDGETS -# include "xwidget.h" -#endif +#include "xwidget.h" #include "emacsgtkfixed.h" /* Silence a bogus diagnostic; see GNOME bug 683906. */ @@ -50,7 +48,6 @@ static void emacs_fixed_get_preferred_width (GtkWidget *widget, static void emacs_fixed_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural); - static GType emacs_fixed_get_type (void); G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) @@ -75,28 +72,28 @@ struct GtkFixedPrivateL GList *children; }; -static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) +static void +emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) { - // For xwidgets. + /* For xwidgets. - // This basically re-implements the base class method and adds an - // additional case for an xwidget view. + This basically re-implements the base class method and adds an + additional case for an xwidget view. - // It would be nicer if the bse class method could be called first, - // and the the xview modification only would remain here. It wasn't - // possible to solve it that way yet. + It would be nicer if the bse class method could be called first, + and the the xview modification only would remain here. It wasn't + possible to solve it that way yet. */ EmacsFixedClass *klass; GtkWidgetClass *parent_class; - struct GtkFixedPrivateL* priv; + struct GtkFixedPrivateL *priv; klass = EMACS_FIXED_GET_CLASS (widget); parent_class = g_type_class_peek_parent (klass); parent_class->size_allocate (widget, allocation); - priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, - GTK_TYPE_FIXED, - struct GtkFixedPrivateL); + priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, GTK_TYPE_FIXED, + struct GtkFixedPrivateL); gtk_widget_set_allocation (widget, allocation); @@ -154,7 +151,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass) widget_class = (GtkWidgetClass*) klass; - widget_class->get_preferred_width = emacs_fixed_get_preferred_width; widget_class->get_preferred_height = emacs_fixed_get_preferred_height; #ifdef HAVE_XWIDGETS @@ -163,7 +159,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass) g_type_class_add_private (klass, sizeof (EmacsFixedPrivate)); } - static void emacs_fixed_init (EmacsFixed *fixed) { @@ -172,14 +167,7 @@ emacs_fixed_init (EmacsFixed *fixed) fixed->priv->f = 0; } -/** - * emacs_fixed_new: - * - * Creates a new #EmacsFixed. - * - * Returns: a new #EmacsFixed. - */ -GtkWidget* +GtkWidget * emacs_fixed_new (struct frame *f) { EmacsFixed *fixed = g_object_new (emacs_fixed_get_type (), NULL); |