1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* gtkinputdialog.c
|
|
|
|
*
|
|
|
|
* Copyright 1997 Owen Taylor <owt1@cornell.edu>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include "gdk/gdkkeysyms.h"
|
|
|
|
#include "gtkbutton.h"
|
1997-12-18 02:17:14 +00:00
|
|
|
#include "gtkentry.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkhbox.h"
|
|
|
|
#include "gtkhseparator.h"
|
|
|
|
#include "gtkinputdialog.h"
|
|
|
|
#include "gtklabel.h"
|
|
|
|
#include "gtklistitem.h"
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtkmenu.h"
|
|
|
|
#include "gtkmenuitem.h"
|
1997-12-18 02:17:14 +00:00
|
|
|
#include "gtknotebook.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkoptionmenu.h"
|
|
|
|
#include "gtkscrolledwindow.h"
|
|
|
|
#include "gtksignal.h"
|
1997-12-18 02:17:14 +00:00
|
|
|
#include "gtktable.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkvbox.h"
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
#include "gtkintl.h"
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
typedef struct {
|
|
|
|
gint index;
|
|
|
|
GtkWidget *entry;
|
|
|
|
GtkInputDialog *inputd;
|
|
|
|
} GtkInputKeyInfo;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ENABLE_DEVICE,
|
|
|
|
DISABLE_DEVICE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define AXIS_LIST_WIDTH 160
|
|
|
|
#define AXIS_LIST_HEIGHT 175
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
#define KEYS_LIST_WIDTH 200
|
|
|
|
#define KEYS_LIST_HEIGHT 175
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Forward declarations */
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
static void gtk_input_dialog_class_init (GtkInputDialogClass *klass);
|
|
|
|
static void gtk_input_dialog_init (GtkInputDialog *inputd);
|
|
|
|
static void gtk_input_dialog_set_device (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gtk_input_dialog_set_mapping_mode (GtkWidget *w,
|
|
|
|
gpointer data);
|
|
|
|
static void gtk_input_dialog_set_axis (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gtk_input_dialog_fill_axes (GtkInputDialog *inputd,
|
|
|
|
GdkDevice *info);
|
|
|
|
static void gtk_input_dialog_set_key (GtkInputKeyInfo *key,
|
|
|
|
guint keyval,
|
|
|
|
GdkModifierType modifiers);
|
|
|
|
static gint gtk_input_dialog_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
GtkInputKeyInfo *key);
|
|
|
|
static void gtk_input_dialog_clear_key (GtkWidget *widget,
|
|
|
|
GtkInputKeyInfo *key);
|
|
|
|
static void gtk_input_dialog_destroy_key (GtkWidget *widget,
|
|
|
|
GtkInputKeyInfo *key);
|
|
|
|
static void gtk_input_dialog_fill_keys (GtkInputDialog *inputd,
|
|
|
|
GdkDevice *info);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static GtkObjectClass *parent_class = NULL;
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint input_dialog_signals[LAST_SIGNAL] = { 0 };
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_input_dialog_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-28 01:56:09 +00:00
|
|
|
static GtkType input_dialog_type = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!input_dialog_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo input_dialog_info =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
"GtkInputDialog",
|
|
|
|
sizeof (GtkInputDialog),
|
|
|
|
sizeof (GtkInputDialogClass),
|
|
|
|
(GtkClassInitFunc) gtk_input_dialog_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_input_dialog_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
input_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG,
|
1997-11-24 22:37:52 +00:00
|
|
|
&input_dialog_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return input_dialog_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_class_init (GtkInputDialogClass *klass)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) klass;
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_DIALOG);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
klass->enable_device = NULL;
|
|
|
|
klass->disable_device = NULL;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
input_dialog_signals[ENABLE_DEVICE] =
|
|
|
|
gtk_signal_new ("enable_device",
|
|
|
|
GTK_RUN_LAST,
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
GTK_CLASS_TYPE (object_class),
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_SIGNAL_OFFSET (GtkInputDialogClass, enable_device),
|
urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if
Wed Oct 25 20:47:41 2000 Tim Janik <timj@gtk.org>
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): urg, removed
implementation of gtk_marshal_VOID__INT_INT_INT_INT. if people do that,
couldn't they at least give it a non-standard name?
* gtk/gtktextlayout.c: arg! yet another implementation of
gtk_marshal_VOID__INT_INT_INT_INT(), is this a conspiracy?
* gtk/gtktextbuffer.c: gotcha! captured a vagabonding
gtk_marshal_VOID__INT_POINTER_INT() implementation, braught it back
home. now i know this _is_ a conspiracy.
* gtk/gtkwidget.c (gtk_widget_class_init): marshaller fixups for
::state-changed.
* gtk/gtkaccelgroup.c (gtk_accel_group_create_remove):
(gtk_accel_group_create_add): marshaller signature fixups.
* gtk/gtklistitem.c (gtk_list_item_class_init): signal creation fixups,
pass in GTK_TYPE_SCROLL_TYPE instead of GTK_TYPE_ENUM.
* gtk/gtkobject.[hc]: removed GTK_CONNECTED flag, it's not valid
anymore.
Tue Oct 24 23:59:21 2000 Tim Janik <timj@gtk.org>
* docs/reference/Makefile.am: disabled SUBDIRS for the moment, since
due to the signal system changes, it wouldn't build currently. to
be fixed soon.
* docs/Changes-2.0.txt: GtkSignal/GSignal updates.
* gtk/gtkwidget.c: ::direction_changed takes an enum as argument,
so it needs gtk_marshal_VOID__ENUM() instead of
gtk_marshal_NONE__UINT().
* gdk/gdk*.c: adapted type registration functions.
* gtk/gtkbindings.c:
* gtk/gtkaccelgroup.c: operate on GSignalQuery, GtkSignalQuery is
gone.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType.
* gtk/gtkobject.c:
(gtk_object_destroy):
(gtk_object_shutdown): fixed recursion guards. basically we have to
catch the case where any of GObject.shutdown() or gtk_object_destroy()
is called during ::destroy, and avoid recursion there.
* gtk/gtktypeutils.c:
* gtk/maketypes.awk: awk-script hackup to provide gtk_type_init() with
boxed_copy/boxed_free. this needs a more general solution based on a
publically installed code-generator utility.
* gtk/gtktypeutils.[hc]: compat aliased GTK_TYPE_BOXED to G_TYPE_BOXED,
glib's gobject has support for that now.
define GtkSignalMarshaller in terms of GSignalCMarshaller.
Mon Oct 23 09:36:42 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]:
* gtk/gtkmarshal.[hc]:
* gtk/Makefile.am: generate marshallers with glib-genmarshal and don't
compile gtkmarshal.c on its own anymore, just include it in gtksignal.c.
removed #include <gtkmarshal.h>s all over the place, gtksignal.h takes
care of that.
* *.c: marshaller name fixups.
* gtk/gtkmarshal.list: added a comment briefing the format.
Sun Oct 22 23:14:39 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]: nuked old implementation. we mostly have
compatibility macros here now. more specifically, most of
the API is preserved (yes, _most_, nonwithstanding the
following exceptions listed, the API is stil lHUGE ;)
things that got removed completely:
GtkSignalQuery, gtk_signal_query(), gtk_signal_n_emissions(),
gtk_signal_n_emissions_by_name(), gtk_signal_handlers_destroy(),
gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
gtk_signal_remove_emission_hook().
non-functional functions variants:
gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook().
the GtkCallbackMarshal argument to gtk_signal_connect_full() is
not supported anymore.
(gtk_signal_compat_matched): new internal function to aid
implementation of the compatibility macros, it provides
functionality to block/unblock/disconnect handlers based
on func/data.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType,
* *.c: adaptions to new type registration API signatures.
Fri Oct 20 15:26:33 2000 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.[hc]: removed G_TYPE_GTK_POINTER cludge.
2000-10-25 22:34:14 +00:00
|
|
|
gtk_marshal_VOID__POINTER,
|
2000-07-03 19:00:23 +00:00
|
|
|
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
input_dialog_signals[DISABLE_DEVICE] =
|
|
|
|
gtk_signal_new ("disable_device",
|
|
|
|
GTK_RUN_LAST,
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
GTK_CLASS_TYPE (object_class),
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_SIGNAL_OFFSET (GtkInputDialogClass, disable_device),
|
urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if
Wed Oct 25 20:47:41 2000 Tim Janik <timj@gtk.org>
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): urg, removed
implementation of gtk_marshal_VOID__INT_INT_INT_INT. if people do that,
couldn't they at least give it a non-standard name?
* gtk/gtktextlayout.c: arg! yet another implementation of
gtk_marshal_VOID__INT_INT_INT_INT(), is this a conspiracy?
* gtk/gtktextbuffer.c: gotcha! captured a vagabonding
gtk_marshal_VOID__INT_POINTER_INT() implementation, braught it back
home. now i know this _is_ a conspiracy.
* gtk/gtkwidget.c (gtk_widget_class_init): marshaller fixups for
::state-changed.
* gtk/gtkaccelgroup.c (gtk_accel_group_create_remove):
(gtk_accel_group_create_add): marshaller signature fixups.
* gtk/gtklistitem.c (gtk_list_item_class_init): signal creation fixups,
pass in GTK_TYPE_SCROLL_TYPE instead of GTK_TYPE_ENUM.
* gtk/gtkobject.[hc]: removed GTK_CONNECTED flag, it's not valid
anymore.
Tue Oct 24 23:59:21 2000 Tim Janik <timj@gtk.org>
* docs/reference/Makefile.am: disabled SUBDIRS for the moment, since
due to the signal system changes, it wouldn't build currently. to
be fixed soon.
* docs/Changes-2.0.txt: GtkSignal/GSignal updates.
* gtk/gtkwidget.c: ::direction_changed takes an enum as argument,
so it needs gtk_marshal_VOID__ENUM() instead of
gtk_marshal_NONE__UINT().
* gdk/gdk*.c: adapted type registration functions.
* gtk/gtkbindings.c:
* gtk/gtkaccelgroup.c: operate on GSignalQuery, GtkSignalQuery is
gone.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType.
* gtk/gtkobject.c:
(gtk_object_destroy):
(gtk_object_shutdown): fixed recursion guards. basically we have to
catch the case where any of GObject.shutdown() or gtk_object_destroy()
is called during ::destroy, and avoid recursion there.
* gtk/gtktypeutils.c:
* gtk/maketypes.awk: awk-script hackup to provide gtk_type_init() with
boxed_copy/boxed_free. this needs a more general solution based on a
publically installed code-generator utility.
* gtk/gtktypeutils.[hc]: compat aliased GTK_TYPE_BOXED to G_TYPE_BOXED,
glib's gobject has support for that now.
define GtkSignalMarshaller in terms of GSignalCMarshaller.
Mon Oct 23 09:36:42 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]:
* gtk/gtkmarshal.[hc]:
* gtk/Makefile.am: generate marshallers with glib-genmarshal and don't
compile gtkmarshal.c on its own anymore, just include it in gtksignal.c.
removed #include <gtkmarshal.h>s all over the place, gtksignal.h takes
care of that.
* *.c: marshaller name fixups.
* gtk/gtkmarshal.list: added a comment briefing the format.
Sun Oct 22 23:14:39 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]: nuked old implementation. we mostly have
compatibility macros here now. more specifically, most of
the API is preserved (yes, _most_, nonwithstanding the
following exceptions listed, the API is stil lHUGE ;)
things that got removed completely:
GtkSignalQuery, gtk_signal_query(), gtk_signal_n_emissions(),
gtk_signal_n_emissions_by_name(), gtk_signal_handlers_destroy(),
gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
gtk_signal_remove_emission_hook().
non-functional functions variants:
gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook().
the GtkCallbackMarshal argument to gtk_signal_connect_full() is
not supported anymore.
(gtk_signal_compat_matched): new internal function to aid
implementation of the compatibility macros, it provides
functionality to block/unblock/disconnect handlers based
on func/data.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType,
* *.c: adaptions to new type registration API signatures.
Fri Oct 20 15:26:33 2000 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.[hc]: removed G_TYPE_GTK_POINTER cludge.
2000-10-25 22:34:14 +00:00
|
|
|
gtk_marshal_VOID__POINTER,
|
2000-07-03 19:00:23 +00:00
|
|
|
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_init (GtkInputDialog *inputd)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *util_box;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *device_menu;
|
|
|
|
GtkWidget *mapping_menu;
|
|
|
|
GtkWidget *menuitem;
|
|
|
|
GtkWidget *optionmenu;
|
|
|
|
GtkWidget *separator;
|
1997-12-18 02:17:14 +00:00
|
|
|
GtkWidget *notebook;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
GList *tmp_list;
|
|
|
|
GList *device_info;
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
device_info = gdk_devices_list ();
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* shell and main vbox */
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (inputd), _("Input"));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (inputd)->vbox), vbox, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
if (g_list_length(device_info) <= 1) /* only core device */
|
|
|
|
{
|
1998-12-14 17:39:58 +00:00
|
|
|
label = gtk_label_new (_("No input devices"));
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), label);
|
|
|
|
|
|
|
|
gtk_widget_show (label);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* menu for selecting device */
|
|
|
|
|
|
|
|
device_menu = gtk_menu_new ();
|
|
|
|
|
|
|
|
for (tmp_list = device_info; tmp_list; tmp_list = tmp_list->next) {
|
2000-07-03 19:00:23 +00:00
|
|
|
GdkDevice *info = (GdkDevice *)(tmp_list->data);
|
|
|
|
if (info != gdk_core_pointer)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
menuitem = gtk_menu_item_new_with_label(info->name);
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (device_menu), menuitem);
|
|
|
|
gtk_widget_show (menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
|
|
|
(GtkSignalFunc) gtk_input_dialog_set_device,
|
2000-07-03 19:00:23 +00:00
|
|
|
info);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
util_box = gtk_hbox_new (FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), util_box, FALSE, FALSE, 0);
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
label = gtk_label_new(_("Device:"));
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
|
|
|
|
|
|
|
optionmenu = gtk_option_menu_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), optionmenu, TRUE, TRUE, 2);
|
|
|
|
gtk_widget_show (optionmenu);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), device_menu);
|
|
|
|
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* Device options */
|
|
|
|
|
|
|
|
/* mapping mode option menu */
|
|
|
|
|
|
|
|
mapping_menu = gtk_menu_new ();
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label(_("Disabled"));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_widget_show (menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
|
|
|
(GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
|
1998-05-13 00:24:57 +00:00
|
|
|
GINT_TO_POINTER (GDK_MODE_DISABLED));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label(_("Screen"));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_widget_show (menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
|
|
|
(GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
|
1998-05-13 00:24:57 +00:00
|
|
|
GINT_TO_POINTER (GDK_MODE_SCREEN));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label(_("Window"));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_widget_show (menuitem);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
|
|
|
(GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
|
1998-05-13 00:24:57 +00:00
|
|
|
GINT_TO_POINTER (GDK_MODE_WINDOW));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
label = gtk_label_new(_("Mode: "));
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
|
|
|
|
|
|
|
|
inputd->mode_optionmenu = gtk_option_menu_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (util_box), inputd->mode_optionmenu, FALSE, FALSE, 2);
|
|
|
|
gtk_widget_show (inputd->mode_optionmenu);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (inputd->mode_optionmenu), mapping_menu);
|
|
|
|
|
|
|
|
gtk_widget_show(label);
|
|
|
|
|
|
|
|
gtk_widget_show (util_box);
|
|
|
|
|
|
|
|
util_box = gtk_hbox_new (FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX(vbox), util_box, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_widget_show (util_box);
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
separator = gtk_hseparator_new();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show (separator);
|
|
|
|
|
|
|
|
/* Notebook */
|
|
|
|
|
|
|
|
notebook = gtk_notebook_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (notebook);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* The axis listbox */
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
label = gtk_label_new (_("Axes"));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
inputd->axis_listbox = gtk_scrolled_window_new (NULL, NULL);
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox),
|
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_set_usize (inputd->axis_listbox, AXIS_LIST_WIDTH, AXIS_LIST_HEIGHT);
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
|
|
|
|
inputd->axis_listbox, label);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (inputd->axis_listbox);
|
|
|
|
|
|
|
|
inputd->axis_list = 0;
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
/* Keys listbox */
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
label = gtk_label_new (_("Keys"));
|
1997-12-18 02:17:14 +00:00
|
|
|
|
|
|
|
inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_widget_set_usize (inputd->keys_listbox, KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->keys_listbox),
|
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
|
|
|
|
inputd->keys_listbox, label);
|
|
|
|
|
|
|
|
gtk_widget_show (inputd->keys_listbox);
|
|
|
|
|
|
|
|
inputd->keys_list = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* ...set_device expects to get input dialog from widget user data */
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (inputd), inputd);
|
2000-07-03 19:00:23 +00:00
|
|
|
gtk_input_dialog_set_device (GTK_WIDGET(inputd), device_info->data);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
/* We create the save button in any case, so that clients can
|
|
|
|
connect to it, without paying attention to whether it exits */
|
1998-12-14 17:39:58 +00:00
|
|
|
inputd->save_button = gtk_button_new_with_label (_("Save"));
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (inputd->save_button, GTK_CAN_DEFAULT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
|
|
|
|
inputd->save_button, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (inputd->save_button);
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
if (g_list_length(device_info) <= 1) /* only core device */
|
|
|
|
gtk_widget_set_sensitive(inputd->save_button, FALSE);
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
inputd->close_button = gtk_button_new_with_label (_("Close"));
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (inputd->close_button, GTK_CAN_DEFAULT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
|
|
|
|
inputd->close_button, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
gtk_widget_show (inputd->close_button);
|
|
|
|
gtk_widget_grab_default (inputd->close_button);
|
|
|
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
gtk_input_dialog_new (void)
|
|
|
|
{
|
|
|
|
GtkInputDialog *inputd;
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
inputd = gtk_type_new (GTK_TYPE_INPUT_DIALOG);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return GTK_WIDGET (inputd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_set_device(GtkWidget *widget, gpointer data)
|
|
|
|
{
|
2000-07-03 19:00:23 +00:00
|
|
|
GdkDevice *device = data;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
GtkInputDialog *inputd = GTK_INPUT_DIALOG(
|
|
|
|
gtk_object_get_user_data(GTK_OBJECT(widget)));
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
inputd->current_device = device;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
gtk_input_dialog_fill_axes(inputd, device);
|
|
|
|
gtk_input_dialog_fill_keys(inputd, device);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_option_menu_set_history(GTK_OPTION_MENU(inputd->mode_optionmenu),
|
2000-07-03 19:00:23 +00:00
|
|
|
device->mode);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-03 19:00:23 +00:00
|
|
|
gtk_input_dialog_set_mapping_mode (GtkWidget *w,
|
|
|
|
gpointer data)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkInputDialog *inputd = GTK_INPUT_DIALOG(
|
|
|
|
gtk_object_get_user_data(GTK_OBJECT(w)));
|
2000-07-03 19:00:23 +00:00
|
|
|
GdkDevice *info = inputd->current_device;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkInputMode old_mode = info->mode;
|
1998-05-13 00:24:57 +00:00
|
|
|
GdkInputMode mode = GPOINTER_TO_INT (data);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (mode != old_mode)
|
|
|
|
{
|
2000-07-03 19:00:23 +00:00
|
|
|
if (gdk_device_set_mode (inputd->current_device, mode))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (mode == GDK_MODE_DISABLED)
|
|
|
|
gtk_signal_emit (GTK_OBJECT (inputd),
|
|
|
|
input_dialog_signals[DISABLE_DEVICE],
|
2000-07-03 19:00:23 +00:00
|
|
|
info);
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
gtk_signal_emit (GTK_OBJECT (inputd),
|
|
|
|
input_dialog_signals[ENABLE_DEVICE],
|
2000-07-03 19:00:23 +00:00
|
|
|
info);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (inputd->mode_optionmenu),
|
|
|
|
old_mode);
|
|
|
|
|
|
|
|
/* FIXME: error dialog ? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data)
|
|
|
|
{
|
1998-05-13 00:24:57 +00:00
|
|
|
GdkAxisUse use = GPOINTER_TO_INT(data) & 0xFFFF;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkAxisUse old_use;
|
|
|
|
GdkAxisUse *new_axes;
|
|
|
|
GtkInputDialog *inputd = GTK_INPUT_DIALOG (gtk_object_get_user_data (GTK_OBJECT (widget)));
|
2000-07-03 19:00:23 +00:00
|
|
|
GdkDevice *info = inputd->current_device;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-05-13 00:24:57 +00:00
|
|
|
gint axis = (GPOINTER_TO_INT(data) >> 16) - 1;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint old_axis;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
new_axes = g_new (GdkAxisUse, info->num_axes);
|
|
|
|
old_axis = -1;
|
|
|
|
for (i=0;i<info->num_axes;i++)
|
|
|
|
{
|
2000-07-03 19:00:23 +00:00
|
|
|
new_axes[i] = info->axes[i].use;
|
|
|
|
if (info->axes[i].use == use)
|
1997-11-24 22:37:52 +00:00
|
|
|
old_axis = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (axis != -1)
|
2000-07-03 19:00:23 +00:00
|
|
|
old_use = info->axes[axis].use;
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
old_use = GDK_AXIS_IGNORE;
|
|
|
|
|
|
|
|
if (axis == old_axis)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* we must always have an x and a y axis */
|
|
|
|
if ((axis == -1 && (use == GDK_AXIS_X || use == GDK_AXIS_Y)) ||
|
|
|
|
(old_axis == -1 && (old_use == GDK_AXIS_X || old_use == GDK_AXIS_Y)))
|
|
|
|
{
|
|
|
|
gtk_option_menu_set_history (
|
|
|
|
GTK_OPTION_MENU (inputd->axis_items[use]),
|
|
|
|
old_axis + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (axis != -1)
|
2000-07-03 19:00:23 +00:00
|
|
|
gdk_device_set_axis_use (info, axis, use);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (old_axis != -1)
|
2000-07-03 19:00:23 +00:00
|
|
|
gdk_device_set_axis_use (info, old_axis, old_use);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (old_use != GDK_AXIS_IGNORE)
|
|
|
|
{
|
|
|
|
gtk_option_menu_set_history (
|
|
|
|
GTK_OPTION_MENU (inputd->axis_items[old_use]),
|
|
|
|
old_axis + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (new_axes);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-03 19:00:23 +00:00
|
|
|
gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const char *axis_use_strings[GDK_AXIS_LAST] =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
"",
|
1998-12-14 17:39:58 +00:00
|
|
|
N_("X"),
|
|
|
|
N_("Y"),
|
|
|
|
N_("Pressure"),
|
|
|
|
N_("X Tilt"),
|
2000-07-03 19:00:23 +00:00
|
|
|
N_("Y Tilt"),
|
|
|
|
N_("Wheel")
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int i,j;
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *option_menu;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
/* remove all the old items */
|
|
|
|
if (inputd->axis_list)
|
|
|
|
{
|
|
|
|
gtk_widget_hide (inputd->axis_list); /* suppress resizes (or get warnings) */
|
|
|
|
gtk_widget_destroy (inputd->axis_list);
|
|
|
|
}
|
1997-12-18 02:17:14 +00:00
|
|
|
inputd->axis_list = gtk_table_new (GDK_AXIS_LAST, 2, 0);
|
1998-12-07 19:03:10 +00:00
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (inputd->axis_listbox),
|
|
|
|
inputd->axis_list);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (inputd->axis_list);
|
|
|
|
|
|
|
|
gtk_widget_realize (inputd->axis_list);
|
|
|
|
gdk_window_set_background (inputd->axis_list->window,
|
1998-02-13 05:26:33 +00:00
|
|
|
&inputd->axis_list->style->base[GTK_STATE_NORMAL]);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
for (i=GDK_AXIS_X;i<GDK_AXIS_LAST;i++)
|
|
|
|
{
|
|
|
|
/* create the label */
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
label = gtk_label_new (_(axis_use_strings[i]));
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_table_attach (GTK_TABLE (inputd->axis_list), label, 0, 1, i, i+1,
|
|
|
|
0, 0, 2, 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* and the use option menu */
|
|
|
|
menu = gtk_menu_new();
|
|
|
|
|
|
|
|
for (j = -1; j < info->num_axes; j++)
|
|
|
|
{
|
|
|
|
char buffer[16];
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
|
|
|
if (j == -1)
|
1998-12-14 17:39:58 +00:00
|
|
|
menu_item = gtk_menu_item_new_with_label (_("none"));
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf (buffer,"%d",j+1);
|
|
|
|
menu_item = gtk_menu_item_new_with_label (buffer);
|
|
|
|
}
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (menu_item), inputd);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
(GtkSignalFunc) gtk_input_dialog_set_axis,
|
1998-05-13 00:24:57 +00:00
|
|
|
GINT_TO_POINTER (0x10000 * (j + 1) + i));
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_show (menu_item);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inputd->axis_items[i] = option_menu = gtk_option_menu_new ();
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_table_attach (GTK_TABLE (inputd->axis_list), option_menu,
|
|
|
|
1, 2, i, i+1, 0, 0, 2, 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_widget_show (option_menu);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
|
|
|
for (j = 0; j < info->num_axes; j++)
|
2000-07-03 19:00:23 +00:00
|
|
|
if (info->axes[j].use == (GdkAxisUse) i)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), j+1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (label);
|
1997-12-18 02:17:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_clear_key (GtkWidget *widget, GtkInputKeyInfo *key)
|
|
|
|
{
|
1998-12-14 17:39:58 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY(key->entry), _("(disabled)"));
|
2000-07-03 19:00:23 +00:00
|
|
|
gdk_device_set_key (key->inputd->current_device, key->index, 0, 0);
|
1997-12-18 02:17:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_set_key (GtkInputKeyInfo *key,
|
|
|
|
guint keyval, GdkModifierType modifiers)
|
|
|
|
{
|
|
|
|
GString *str;
|
|
|
|
gchar chars[2];
|
|
|
|
|
|
|
|
if (keyval)
|
|
|
|
{
|
|
|
|
str = g_string_new("");
|
|
|
|
|
|
|
|
if (modifiers & GDK_SHIFT_MASK)
|
|
|
|
g_string_append (str, "Shft+");
|
|
|
|
if (modifiers & GDK_CONTROL_MASK)
|
|
|
|
g_string_append (str, "Ctl+");
|
|
|
|
if (modifiers & GDK_MOD1_MASK)
|
|
|
|
g_string_append (str, "Alt+");
|
|
|
|
|
|
|
|
if ((keyval >= 0x20) && (keyval <= 0xFF))
|
|
|
|
{
|
|
|
|
chars[0] = keyval;
|
|
|
|
chars[1] = 0;
|
|
|
|
g_string_append (str, chars);
|
|
|
|
}
|
|
|
|
else
|
1998-12-14 17:39:58 +00:00
|
|
|
g_string_append (str, _("(unknown)"));
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY(key->entry), str->str);
|
|
|
|
|
|
|
|
g_string_free (str, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-12-14 17:39:58 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY(key->entry), _("(disabled)"));
|
1997-12-18 02:17:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_input_dialog_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
GtkInputKeyInfo *key)
|
|
|
|
{
|
|
|
|
gtk_input_dialog_set_key (key, event->keyval, event->state & 0xFF);
|
2000-07-03 19:00:23 +00:00
|
|
|
gdk_device_set_key (key->inputd->current_device, key->index,
|
|
|
|
event->keyval, event->state & 0xFF);
|
1997-12-18 02:17:14 +00:00
|
|
|
|
|
|
|
gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key_press_event");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_input_dialog_destroy_key (GtkWidget *widget, GtkInputKeyInfo *key)
|
|
|
|
{
|
|
|
|
g_free (key);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-03 19:00:23 +00:00
|
|
|
gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info)
|
1997-12-18 02:17:14 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *button;
|
|
|
|
|
1998-05-03 22:41:32 +00:00
|
|
|
char buffer[32];
|
1997-12-18 02:17:14 +00:00
|
|
|
|
|
|
|
/* remove all the old items */
|
|
|
|
if (inputd->keys_list)
|
|
|
|
{
|
|
|
|
gtk_widget_hide (inputd->keys_list); /* suppress resizes (or get warnings) */
|
|
|
|
gtk_widget_destroy (inputd->keys_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
inputd->keys_list = gtk_table_new (info->num_keys, 3, FALSE);
|
1998-12-07 19:03:10 +00:00
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (inputd->keys_listbox),
|
|
|
|
inputd->keys_list);
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_widget_show (inputd->keys_list);
|
|
|
|
|
|
|
|
gtk_widget_realize (inputd->keys_list);
|
|
|
|
gdk_window_set_background (inputd->keys_list->window,
|
1998-02-13 05:26:33 +00:00
|
|
|
&inputd->keys_list->style->base[GTK_STATE_NORMAL]);
|
1997-12-18 02:17:14 +00:00
|
|
|
|
|
|
|
for (i=0;i<info->num_keys;i++)
|
|
|
|
{
|
|
|
|
GtkInputKeyInfo *key = g_new (GtkInputKeyInfo, 1);
|
|
|
|
key->index = i;
|
|
|
|
key->inputd = inputd;
|
|
|
|
|
|
|
|
/* create the label */
|
|
|
|
|
|
|
|
sprintf(buffer, "%d", i+1);
|
|
|
|
label = gtk_label_new(buffer);
|
|
|
|
gtk_table_attach (GTK_TABLE (inputd->keys_list), label, 0, 1, i, i+1,
|
|
|
|
0, 0, 2, 2);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* the entry */
|
|
|
|
|
|
|
|
key->entry = gtk_entry_new ();
|
|
|
|
gtk_table_attach (GTK_TABLE (inputd->keys_list), key->entry, 1, 2, i, i+1,
|
|
|
|
GTK_EXPAND | GTK_FILL , 0, 2, 2);
|
|
|
|
gtk_widget_show (key->entry);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT(key->entry), "key_press_event",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_input_dialog_key_press), key);
|
|
|
|
gtk_signal_connect (GTK_OBJECT(key->entry), "destroy",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_input_dialog_destroy_key),
|
|
|
|
key);
|
|
|
|
|
|
|
|
/* and clear button */
|
|
|
|
|
1998-12-14 17:39:58 +00:00
|
|
|
button = gtk_button_new_with_label (_("clear"));
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_table_attach (GTK_TABLE (inputd->keys_list), button, 2, 3, i, i+1,
|
|
|
|
0, 0, 2, 2);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT(button), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_input_dialog_clear_key), key);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
gtk_input_dialog_set_key (key, info->keys[i].keyval,
|
|
|
|
info->keys[i].modifiers);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|