From 3e8298b9a4e07a21ec39bb29e470a0bacc916a45 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 16 Dec 2002 11:38:21 +0000 Subject: [PATCH] Remove work-arounds for xforms < 0.89.5. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5817 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 16 ++ src/frontends/xforms/FormBase.C | 79 ++++---- src/frontends/xforms/Makefile.am | 15 +- src/frontends/xforms/Menubar_pimpl.C | 4 - src/frontends/xforms/Tooltips.C | 139 ------------- src/frontends/xforms/Tooltips.h | 26 +-- src/frontends/xforms/XFormsView.C | 9 +- src/frontends/xforms/XWorkArea.C | 30 --- src/frontends/xforms/combox.C | 2 + src/frontends/xforms/lyx_gui.C | 14 -- src/frontends/xforms/lyxlookup.C | 284 --------------------------- src/frontends/xforms/lyxlookup.h | 31 --- src/frontends/xforms/xforms_resize.C | 38 +--- 13 files changed, 71 insertions(+), 616 deletions(-) delete mode 100644 src/frontends/xforms/lyxlookup.C delete mode 100644 src/frontends/xforms/lyxlookup.h diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 6fce91a77a..d5ad2c6b14 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,19 @@ +2002-12-13 Angus Leeming + + * FormBase.C: + * Menubar_pimpl.C: + * Tooltips.[Ch]: + * XFormsView.C: + * XWorkArea.C: + * lyx_gui.C: + * xforms_resize.C: remove work-arounds for xforms < 0.89.5. + + * lyxlookup.[Ch]: removed. + + * Makefile.am: associated change. + + * combox.C: add block #ifdef FL_VERSION < 1 + 2002-12-16 Michael Schmitt * FormGraphics.C (build): correct string for boost::format. diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index 01ba81f7e3..391dfc1faf 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -32,15 +32,11 @@ extern "C" { -#if FL_VERSION > 0 || FL_REVISION >= 89 - // These should be in forms.h but aren't void fl_show_tooltip(const char *, int, int); void fl_hide_tooltip(); -#endif - // Callback function invoked by xforms when the dialog is closed by the // window manager. static int C_WMHideCB(FL_FORM * form, void *); @@ -170,7 +166,7 @@ void FormBase::show() void FormBase::hide() { -#if FL_VERSION > 0 || FL_REVISION >= 89 +#if FL_VERSION < 1 // Does no harm if none is visible and ensures that the tooltip form // is hidden should the dialog be closed from the keyboard. fl_hide_tooltip(); @@ -259,46 +255,55 @@ void FormBase::PrehandlerCB(FL_OBJECT * ob, int event, int key) return; } - - if (event != FL_ENTER && event != FL_LEAVE) - return; - - if (ob->objclass == FL_TABFOLDER) { - // This prehandler is used to work-around an xforms bug and - // ensures that the form->x, form->y coords of the active - // tabfolder are up to date. - - // The tabfolder itself can be very narrow, being just - // the visible border to the tabs. - // We thus use both FL_ENTER and FL_LEAVE as flags, - // in case the FL_ENTER event is not caught. - - FL_FORM * const folder = fl_get_active_folder(ob); - if (folder && folder->window) { - fl_get_winorigin(folder->window, - &(folder->x), &(folder->y)); + switch (event) { + case FL_ENTER: + case FL_LEAVE: + if (message_widget_) { + // Post feedback as the mouse enters the object, + // remove it as the mouse leaves. + MessageCB(ob, event); } +#if FL_VERSION < 1 + if (ob->objclass == FL_TABFOLDER) { + // This prehandler is used to work-around an xforms + // bug and ensures that the form->x, form->y coords of + // the active tabfolder are up to date. + + // The tabfolder itself can be very narrow, being just + // the visible border to the tabs. + // We thus use both FL_ENTER and FL_LEAVE as flags, + // in case the FL_ENTER event is not caught. + + FL_FORM * const folder = fl_get_active_folder(ob); + if (folder && folder->window) { + fl_get_winorigin(folder->window, + &(folder->x), &(folder->y)); + } + } +#endif + break; } - if (message_widget_) { - // Post feedback as the mouse enters the object, - // remove it as the mouse leaves. - MessageCB(ob, event); - } - -#if FL_VERSION > 0 || FL_REVISION >= 89 // Tooltips are not displayed on browser widgets due to an xforms' bug. + // I have a fix, but it's not yet in the xforms sources. // This is a work-around: - if (ob->objclass == FL_BROWSER) { - if (event == FL_ENTER && ob->tooltip && *(ob->tooltip)) { - fl_show_tooltip(ob->tooltip, ob->form->x + ob->x, - ob->form->y + ob->y + ob->h + 1); - } else if (event == FL_LEAVE) { - fl_hide_tooltip(); + switch (event) { + case FL_ENTER: + if (ob->objclass == FL_BROWSER && + ob->tooltip && *(ob->tooltip)) { + int const x = ob->form->x + ob->x; + int const y = ob->form->y + ob->y + ob->h + 1; + fl_show_tooltip(ob->tooltip, x, y); } + break; + case FL_LEAVE: + case FL_PUSH: + case FL_KEYPRESS: + if (ob->objclass == FL_BROWSER) + fl_hide_tooltip(); + break; } -#endif } diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 5f022279ae..58e403ab42 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -11,11 +11,6 @@ SUBDIRS = forms EXTRA_DIST = xformsImage.C xformsImage.h -if USE_BASIC_IMAGE_LOADER -else -XFORMSIMAGE = xformsImage.C xformsImage.h -endif - # Alphabetical order please. It makes it easier to figure out what's missing. libxforms_la_SOURCES = \ forms_fwd.h \ @@ -32,8 +27,6 @@ libxforms_la_SOURCES = \ input_validators.C \ input_validators.h \ lyx_gui.C \ - lyxlookup.C \ - lyxlookup.h \ xfont_loader.C \ xfont_loader.h \ xfont_metrics.C \ @@ -42,7 +35,9 @@ libxforms_la_SOURCES = \ xforms_helpers.h \ xforms_resize.C \ xforms_resize.h \ - $(XFORMSIMAGE) xformsBC.C \ + xformsImage.C \ + xformsImage.h \ + xformsBC.C \ xformsBC.h \ xscreen.C \ xscreen.h \ @@ -169,10 +164,6 @@ libxforms_la_SOURCES = \ libxforms.la: $(libxforms_la_OBJECTS) $(libxforms_la_DEPENDENCIES) -# for convenience only -updatesrc: - $(MAKE) -C forms updatesrc - # just copied from old lyx repository #dist-hook: # for subdir in $(LYXDATADIRS) ; do \ diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index 996558f41c..7acae94e10 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -189,11 +189,7 @@ int get_new_submenu(vector & smn, Window win) string const fixlabel(string const & str) { -#if FL_VERSION < 1 && FL_REVISION < 89 - return subst(str, '%', '?'); -#else return subst(str, "%", "%%"); -#endif } diff --git a/src/frontends/xforms/Tooltips.C b/src/frontends/xforms/Tooltips.C index 316f060fc5..be367d65dc 100644 --- a/src/frontends/xforms/Tooltips.C +++ b/src/frontends/xforms/Tooltips.C @@ -34,8 +34,6 @@ bool Tooltips::enabled_ = true; boost::signal0 Tooltips::toggled; -#if FL_VERSION > 0 || FL_REVISION >= 89 - Tooltips::Tooltips() { toggled.connect(boost::bind(&Tooltips::set, this)); @@ -76,140 +74,3 @@ void Tooltips::init(FL_OBJECT * ob, string const & tip) char const * const c_str = enabled_ ? str.c_str() : 0; fl_set_object_helper(ob, c_str); } - - -#else // if FL_REVISION < 89 - -namespace { - -int TooltipHandler(FL_OBJECT *ob, int event); - -void TooltipTimerCB(FL_OBJECT * timer, long data); - -} - -extern "C" { - -static int C_TooltipHandler(FL_OBJECT * ob, int event, - FL_Coord, FL_Coord, int, void *) -{ - return TooltipHandler(ob, event); -} - - -static void C_TooltipTimerCB(FL_OBJECT * ob, long data) -{ - TooltipTimerCB(ob, data); -} - -} - - -Tooltips::Tooltips() - : tooltip_timer_(0) -{ - toggled.connect(boost::bind(&Tooltips::set, this)); -} - - -void Tooltips::toggleEnabled() -{ - enabled_ = !enabled_; - toggled(); -} - - -void Tooltips::set() -{} - - -void Tooltips::init(FL_OBJECT * ob, string const & tip) -{ - lyx::Assert(ob && ob->form); - - // Paranoia check! - TooltipsMap::const_iterator it = tooltipsMap.find(ob); - if (it != tooltipsMap.end()) - return; - - string const str = trim(tip); - if (str.empty()) - return; - - // Store the tooltip string - tooltipsMap[ob] = formatted(str, 400); - - if (!tooltip_timer_) { - if (fl_current_form && ob->form != fl_current_form) - fl_end_form(); - - bool const open_form = !fl_current_form; - if (open_form) - fl_addto_form(ob->form); - - tooltip_timer_ = fl_add_timer(FL_HIDDEN_TIMER, 0, 0, 0, 0, ""); - - if (open_form) - fl_end_form(); - } - - fl_set_object_posthandler(ob, C_TooltipHandler); - ob->u_cdata = reinterpret_cast(tooltip_timer_); - tooltip_timer_->u_vdata = this; -} - - -string const Tooltips::get(FL_OBJECT * ob) const -{ - TooltipsMap::const_iterator it = tooltipsMap.find(ob); - if (it == tooltipsMap.end()) - return string(); - return it->second; -} - - -namespace { - -void TooltipTimerCB(FL_OBJECT * timer, long data) -{ - FL_OBJECT * ob = reinterpret_cast(data); - lyx::Assert(ob && ob->form && timer && timer->u_vdata); - FL_FORM * form = ob->form; - Tooltips * tooltip = static_cast(timer->u_vdata); - - string const help = tooltip->get(ob); - if (help.empty()) - return; - - fl_show_oneliner(help.c_str(), - form->x + ob->x, form->y + ob->y + ob->h); -} - - -// post_handler for tooltip help -int TooltipHandler(FL_OBJECT * ob, int event) -{ - if (!Tooltips::enabled()) - return 0; - - lyx::Assert(ob); - FL_OBJECT * timer = reinterpret_cast(ob->u_cdata); - lyx::Assert(timer); - - // We do not test for empty help here, since this can never happen - if (event == FL_ENTER) { - fl_set_object_callback(timer, - C_TooltipTimerCB, - reinterpret_cast(ob)); - fl_set_timer(timer, 1); - } - else if (event != FL_MOTION) { - fl_set_timer(timer, 0); - fl_hide_oneliner(); - } - return 0; -} - -} // namespace anon - -#endif // FL_REVISION >= 89 diff --git a/src/frontends/xforms/Tooltips.h b/src/frontends/xforms/Tooltips.h index 60536c22ab..45b463aa28 100644 --- a/src/frontends/xforms/Tooltips.h +++ b/src/frontends/xforms/Tooltips.h @@ -18,6 +18,10 @@ #ifndef TOOLTIPS_H #define TOOLTIPS_H +#ifdef __GNUG__ +#pragma interface +#endif + #include "LString.h" #include @@ -28,10 +32,6 @@ #include -#ifdef __GNUG__ -#pragma interface -#endif - class Tooltips : boost::noncopyable, public boost::signals::trackable { public: /// @@ -43,15 +43,6 @@ public: /// Are the tooltips on or off? static bool enabled() { return enabled_; } -#if FL_VERSION < 1 && FL_REVISION < 89 - - /** Return the tooltip associated with this object. - * Required by an xforms callback routine. - */ - string const get(FL_OBJECT *) const; - -#endif - /** This method is connected to Dialogs::toggleTooltips and toggles * the state of enabled_. */ @@ -74,15 +65,6 @@ private: typedef std::map TooltipsMap; TooltipsMap tooltipsMap; - -#if FL_VERSION < 1 && FL_REVISION < 89 - - /** A timer is started once the mouse enters an object, so that the - * tip appears a short delay afterwards. - */ - FL_OBJECT * tooltip_timer_; - -#endif }; #endif // TOOLTIPS_H diff --git a/src/frontends/xforms/XFormsView.C b/src/frontends/xforms/XFormsView.C index 59e25ac9bc..8cf898ee30 100644 --- a/src/frontends/xforms/XFormsView.C +++ b/src/frontends/xforms/XFormsView.C @@ -16,10 +16,8 @@ #include "XFormsView.h" #include FORMS_H_LOCATION -#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) -#include "frontends/xforms/lyxlookup.h" -#endif -#include "frontends/xforms/XMiniBuffer.h" + +#include "XMiniBuffer.h" #include "debug.h" #include "intl.h" #include "lyxrc.h" @@ -123,9 +121,6 @@ void XFormsView::show(int x, int y, string const & title) fl_show_form(form, placement, FL_FULLBORDER, title.c_str()); show_view_state(); -#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) - InitLyXLookup(fl_get_display(), form_->window); -#endif } diff --git a/src/frontends/xforms/XWorkArea.C b/src/frontends/xforms/XWorkArea.C index 75653a5475..82696860eb 100644 --- a/src/frontends/xforms/XWorkArea.C +++ b/src/frontends/xforms/XWorkArea.C @@ -21,10 +21,6 @@ #include "funcrequest.h" #include "Timeout.h" -#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) -#include "lyxlookup.h" -#endif - using std::endl; using std::abs; using std::hex; @@ -306,11 +302,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event, ev->xbutton.y - ob->y, x_button_state(key))); break; -#if FL_VERSION < 1 && FL_REVISION < 89 - case FL_MOUSE: -#else case FL_DRAG: -#endif { if (!ev || !area->scrollbar) break; @@ -376,24 +368,14 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event, break; } -#if FL_VERSION < 1 && FL_REVISION < 89 - case FL_KEYBOARD: -#else case FL_KEYPRESS: -#endif { lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl; KeySym keysym = 0; char dummy[1]; XKeyEvent * xke = reinterpret_cast(ev); -#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) - // XForms < 0.89.5 does not have compose support - // so we are using our own compose support - LyXLookupString(ev, dummy, 1, &keysym); -#else XLookupString(xke, dummy, 1, &keysym, 0); -#endif if (lyxerr.debugging(Debug::KEY)) { char const * const tmp = XKeysymToString(key); @@ -407,15 +389,6 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event, << "' [" << keysym << ']' << endl; } -#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) - if (keysym == NoSymbol) { - lyxerr[Debug::KEY] - << "Empty kdb action (probably composing)" - << endl; - break; - } - KeySym ret_key = keysym; -#else // Note that we need this handling because of a bug // in XForms 0.89, if this bug is resolved in the way I hope // we can just use the keysym directly without looking @@ -447,7 +420,6 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event, //} } -#endif unsigned int const ret_state = xke->state; // If you have a better way to handle "wild-output" of @@ -488,11 +460,9 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event, } break; -#if FL_VERSION > 0 || FL_REVISION >= 89 case FL_KEYRELEASE: lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl; break; -#endif case FL_ENTER: lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl; diff --git a/src/frontends/xforms/combox.C b/src/frontends/xforms/combox.C index 6100cdf17e..269fd722f5 100644 --- a/src/frontends/xforms/combox.C +++ b/src/frontends/xforms/combox.C @@ -282,6 +282,7 @@ void Combox::show() fl_redraw_object(button); } +#if FL_VERSION < 1 // This fix ensures that, even if label lies on a tabfolder, // the x,y coords of the underlying form are up to date. // It should be rendered redundant by a similar fix in the @@ -292,6 +293,7 @@ void Combox::show() FL_FORM * lf = label->form; fl_get_winorigin(lf->window, &(lf->x), &(lf->y)); } +#endif int const x = label->form->x + label->x; int const y = label->form->y + label->y + label->h; diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index b668a283b5..7c80857880 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -35,11 +35,7 @@ #include "ColorHandler.h" #include "xforms_helpers.h" #include "xfont_loader.h" -#ifdef USE_XFORMS_IMAGE_LOADER #include "xformsImage.h" -#else -#include "graphics/GraphicsImageXPM.h" -#endif #include "Lsstream.h" #include @@ -169,15 +165,9 @@ void lyx_gui::parse_init(int & argc, char * argv[]) using namespace grfx; -#ifdef USE_XFORMS_IMAGE_LOADER // connect the image loader based on the xforms library Image::newImage = boost::bind(&xformsImage::newImage); Image::loadableFormats = boost::bind(&xformsImage::loadableFormats); -#else - // connect the image loader based on the XPM library - Image::newImage = boost::bind(&ImageXPM::newImage); - Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats); -#endif // must do this /before/ lyxrc gets read lyxrc.dpi = getDPI(); @@ -231,11 +221,7 @@ void lyx_gui::parse_lyxrc() fl_setpup_fontsize(FL_NORMAL_SIZE); fl_setpup_color(FL_MCOL, FL_BLACK); fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE); -#if FL_REVISION < 89 - fl_set_oneliner_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE); -#else fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE); -#endif } diff --git a/src/frontends/xforms/lyxlookup.C b/src/frontends/xforms/lyxlookup.C deleted file mode 100644 index c894a08f1a..0000000000 --- a/src/frontends/xforms/lyxlookup.C +++ /dev/null @@ -1,284 +0,0 @@ -/** - * \file lyxlookup.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * - * Full author contact details are available in file CREDITS - */ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include - -#ifdef HAVE_XOPENIM -// This part is the full blown Input Method manager for X11R5 and up. -// For the plain-and-old-X11R4 version, see later. -#include -#include -#include -#ifdef HAVE_LOCALE_H -#include -#endif -#include - -#include "lyxlookup.h" -#include "debug.h" -#include "lyxrc.h" - -using std::endl; - -namespace { - -XIM xim; -XIC xic; -XComposeStatus compose_status= {0, 0}; - -} // namespace anon - - -// This is called after the main LyX window has been created -void InitLyXLookup(Display * display, Window window) -{ - xic = 0; - - lyxerr[Debug::KEY] - << "InitLyXLookup: creating an input context." - << endl; - - // This part could be done before opening display - string oldlocale = setlocale(LC_CTYPE, 0); - setlocale(LC_CTYPE, ""); - if (!XSupportsLocale()) { - lyxerr[Debug::KEY] - << "InitLyXLookup: X does not support this locale." - << endl; - return; - } - // reset the LC_CTYPE locale to previous value. - setlocale(LC_CTYPE, oldlocale.c_str()); - - char const * locmod; - if (!(locmod = XSetLocaleModifiers(""))) { - lyxerr[Debug::KEY] << "InitLyXLookup: Could not set modifiers " - "for this locale." << endl; - return; - } - else - lyxerr[Debug::KEY] << "InitLyXLookup: X locale modifiers are `" - << locmod << '\'' << endl; - - // This part will have to be done for each frame - xim = XOpenIM (display, 0, 0, 0); - if (xim) { - xic = XCreateIC(xim, - XNInputStyle, - XIMPreeditNothing|XIMStatusNothing, - XNClientWindow, window, - XNFocusWindow, window, - 0); - - if (!xic) { - lyxerr[Debug::KEY] << "InitLyXLookup: " - "could not create an input context" << endl; - XCloseIM (xim); - xim = 0; - } - } - else - lyxerr[Debug::KEY] << "InitLyXLookup: could not open " - "an input method." << endl; -} - - -namespace { - -bool isDeadEvent(KeySym keysym) -{ - // Can this be done safely in any other way? - // This is all the dead keys I know of in X11R6.1 - switch (keysym) { -#ifdef XK_dead_grave - case XK_dead_grave: -#endif -#ifdef XK_dead_acute - case XK_dead_acute: -#endif -#ifdef XK_dead_circumflex - case XK_dead_circumflex: -#endif -#ifdef XK_dead_tilde - case XK_dead_tilde: -#endif -#ifdef XK_dead_macron - case XK_dead_macron: -#endif -#ifdef XK_dead_breve - case XK_dead_breve: -#endif -#ifdef XK_dead_abovedot - case XK_dead_abovedot: -#endif -#ifdef XK_dead_diaeresis - case XK_dead_diaeresis: -#endif -#ifdef XK_dead_abovering - case XK_dead_abovering: -#endif -#ifdef XK_dead_doubleacute - case XK_dead_doubleacute: -#endif -#ifdef XK_dead_caron - case XK_dead_caron: -#endif -#ifdef XK_dead_cedilla - case XK_dead_cedilla: -#endif -#ifdef XK_dead_ogonek - case XK_dead_ogonek: -#endif -#ifdef XK_dead_iota - case XK_dead_iota: -#endif -#ifdef XK_dead_voiced_sound - case XK_dead_voiced_sound: -#endif -#ifdef XK_dead_semivoiced_sound - case XK_dead_semivoiced_sound: -#endif -#ifdef XK_dead_belowdot - case XK_dead_belowdot: -#endif - return true; - default: - return false; - } -} - -} // namespace anon - - -// This is called instead of XLookupString() -int LyXLookupString(XEvent * event, - char * buffer_return, int bytes_buffer, - KeySym * keysym_return) -{ - if (event->type != KeyPress) { - lyxerr << "LyXLookupString: wrong event type: " - << event->type << endl; - return 0; - } - - int result = 0; - if (xic) { -#if 1 - // somehow it is necessary to do the lookup. Why? (JMarc) - XLookupString(&event->xkey, buffer_return, - bytes_buffer, keysym_return, - 0); - - if (lyxrc.override_x_deadkeys && - isDeadEvent(*keysym_return)) { - lyxerr[Debug::KEY] - << "LyXLookupString: found DeadEvent" << endl; - return 0; - } -#endif -#if 1 - if (XFilterEvent (event, None)) { - lyxerr[Debug::KEY] <<"XFilterEvent" << endl; - *keysym_return = NoSymbol; - return 0; - } -#endif - Status status_return = 0; - - result = XmbLookupString(xic, &event->xkey, buffer_return, - bytes_buffer, keysym_return, - &status_return); - switch (status_return) { - case XBufferOverflow: - lyxerr[Debug::KEY] << "XBufferOverflow" << endl; - break; - case XLookupBoth: - lyxerr[Debug::KEY] << "XLookupBoth " - << string(buffer_return, result) - << endl; - break; - case XLookupChars: - lyxerr[Debug::KEY] << "XLookupChars " - << string(buffer_return, result) - << endl; - - *keysym_return = NoSymbol; - break; - case XLookupKeySym: - lyxerr[Debug::KEY] << "XLookupKeySym" << endl; - result = 0; - break; - case XLookupNone: - lyxerr[Debug::KEY] << "XLookupNone" << endl; - *keysym_return = NoSymbol; - result = 0; - break; - default: - lyxerr << "Unknown status_return from" - " XmbLookupString" << endl; - break; - } - } else { - result = XLookupString(&event->xkey, buffer_return, - bytes_buffer, keysym_return, - &compose_status); - } - return result; -} - - -// This is called after the main window has been destroyed -void CloseLyXLookup() -{ - if (xic) { - lyxerr[Debug::KEY] << "CloseLyXLookup: destroying input context" - << endl; - XDestroyIC(xic); - xic = 0; - XCloseIM(xim); - } -} - - -#else // We do not have XOpenIM, so we stick with normal XLookupString - -#include -#include - -XComposeStatus compose_status= {0, 0}; - -// This is called after the main LyX window has been created -void InitLyXLookup(Display *, Window) -{ - //Nothing to do. -} - -// This is called instead of XLookupString(). I this particular case, -// this *is* XLookupString... -int LyXLookupString(XEvent * event, - char * buffer_return, int bytes_buffer, - KeySym * keysym_return) -{ - return XLookupString(&event->xkey, buffer_return, - bytes_buffer, keysym_return, - &compose_status); -} - -// This is called after the main window has been destroyed -void CloseLyXLookup() -{ - // Nothing to do -} - -#endif // HAVE_XOPENIM diff --git a/src/frontends/xforms/lyxlookup.h b/src/frontends/xforms/lyxlookup.h deleted file mode 100644 index 263a6f4cf8..0000000000 --- a/src/frontends/xforms/lyxlookup.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * \file lyxlookup.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * - * Full author contact details are available in file CREDITS - */ - -/* This header file defines wrappers around the X input method related - functions. This should probably be moved into LyXView (to have - different input methods for different frames, but for now we can - keep it as it is. */ -#ifndef LYXLOOKUP_H -#define LYXLOOKUP_H - -#include - -/// Initialize the compose key handling -extern void InitLyXLookup(Display *, Window); - -/// Read a keysym and/or a string (like XLookupString) -extern int LyXLookupString(XEvent * event, - char * buffer_return, int bytes_buffer, - KeySym * keysym_return); - -/// Call this when you destroy your window -extern void CloseLyXLookup(); - -#endif diff --git a/src/frontends/xforms/xforms_resize.C b/src/frontends/xforms/xforms_resize.C index 54c9faddc1..b337397d7a 100644 --- a/src/frontends/xforms/xforms_resize.C +++ b/src/frontends/xforms/xforms_resize.C @@ -94,40 +94,6 @@ double get_scaling_factor(FL_FORM * form) } -// A nasty hack for older xforms versions -int get_tabfolder_numfolders(FL_OBJECT * folder) -{ -#if FL_VERSION > 0 || FL_REVISION > 88 - return fl_get_tabfolder_numfolders(folder); -#else - if (folder->objclass != FL_TABFOLDER) - return 0; - - fl_freeze_form(folder->form); - int const saved_folder_id = fl_get_folder_number(folder); - - int num_folders = 0; - FL_FORM const * old_leaf = 0; - for (;;) { - int const id = num_folders + 1; - fl_set_folder_bynumber(folder, id); - FL_FORM const * const leaf = fl_get_folder(folder); - if (!leaf || leaf == old_leaf) { - // unable to increment succesfully. - break; - } - old_leaf = leaf; - ++num_folders; - } - - fl_set_folder_bynumber(folder, saved_folder_id); - fl_unfreeze_form(folder->form); - - return num_folders; -#endif -} - - double get_tabfolder_scale_to_fit(FL_OBJECT * folder) { lyx::Assert(folder && folder->objclass == FL_TABFOLDER); @@ -136,7 +102,7 @@ double get_tabfolder_scale_to_fit(FL_OBJECT * folder) int const saved_folder_id = fl_get_folder_number(folder); double factor = 1.0; - int const size = get_tabfolder_numfolders(folder); + int const size = fl_get_tabfolder_numfolders(folder); for (int i = 0; i < size; ++i) { fl_set_folder_bynumber(folder, i+1); FL_FORM * leaf = fl_get_folder(folder); @@ -157,7 +123,7 @@ void scale_tabfolder_horizontally(FL_OBJECT * folder, double factor) fl_freeze_form(folder->form); int const saved_folder_id = fl_get_folder_number(folder); - int const size = get_tabfolder_numfolders(folder); + int const size = fl_get_tabfolder_numfolders(folder); for (int i = 0; i < size; ++i) { fl_set_folder_bynumber(folder, i+1); FL_FORM * leaf = fl_get_folder(folder); -- 2.39.2