summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantiago M. Mola <coldwind@gentoo.org>2007-12-15 21:12:22 +0000
committerSantiago M. Mola <coldwind@gentoo.org>2007-12-15 21:12:22 +0000
commitcf5429aa2838c193672df9f9c9d79db0ebd38b52 (patch)
tree3b47a4d54b4128e4396e49711facbdadc5adcf3a /x11-libs/fltk/files
parentInitial addition as a dependency of app-misc/jbidwatcher. Ebuild written by me. (diff)
downloadhistorical-cf5429aa2838c193672df9f9c9d79db0ebd38b52.tar.gz
historical-cf5429aa2838c193672df9f9c9d79db0ebd38b52.tar.bz2
historical-cf5429aa2838c193672df9f9c9d79db0ebd38b52.zip
Fix xft support, see #99993 (Thanks to Aaron M. Ucko).
Package-Manager: portage-2.1.3.19
Diffstat (limited to 'x11-libs/fltk/files')
-rw-r--r--x11-libs/fltk/files/digest-fltk-1.1.7-r33
-rw-r--r--x11-libs/fltk/files/fltk-1.1.7-xft-and-misc.patch535
2 files changed, 538 insertions, 0 deletions
diff --git a/x11-libs/fltk/files/digest-fltk-1.1.7-r3 b/x11-libs/fltk/files/digest-fltk-1.1.7-r3
new file mode 100644
index 000000000000..f20ba91db664
--- /dev/null
+++ b/x11-libs/fltk/files/digest-fltk-1.1.7-r3
@@ -0,0 +1,3 @@
+MD5 2e29319119adc9d63b2f26b72cae0a88 fltk-1.1.7-source.tar.bz2 2060757
+RMD160 a539a1c6bb3363e54bc82c7995037c5d8ede9dd7 fltk-1.1.7-source.tar.bz2 2060757
+SHA256 855a97e35da823f205253b865758715872cd2c7720e4dcf134a3b6dc18bfb96a fltk-1.1.7-source.tar.bz2 2060757
diff --git a/x11-libs/fltk/files/fltk-1.1.7-xft-and-misc.patch b/x11-libs/fltk/files/fltk-1.1.7-xft-and-misc.patch
new file mode 100644
index 000000000000..6f695b46b646
--- /dev/null
+++ b/x11-libs/fltk/files/fltk-1.1.7-xft-and-misc.patch
@@ -0,0 +1,535 @@
+--- FL/x.H
++++ FL/x.H
+@@ -65,10 +65,30 @@
+ extern FL_EXPORT XVisualInfo *fl_visual;
+ extern FL_EXPORT Colormap fl_colormap;
+
++// access to core fonts
++FL_EXPORT XFontStruct* fl_xxfont();
++class Fl_XFont_On_Demand
++{
++public:
++ Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
++ Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
++ { ptr = x.ptr; return *this; }
++ Fl_XFont_On_Demand& operator=(XFontStruct* p)
++ { ptr = p; return *this; }
++ XFontStruct* value() { if (!ptr) { ptr = fl_xxfont(); } return ptr; }
++ operator XFontStruct*() { return value(); }
++ XFontStruct& operator*() { return *value(); }
++ XFontStruct* operator->() { return value(); }
++ bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
++ bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
++private:
++ XFontStruct* ptr;
++};
++extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
++
+ // drawing functions:
+ extern FL_EXPORT GC fl_gc;
+ extern FL_EXPORT Window fl_window;
+-extern FL_EXPORT XFontStruct* fl_xfont;
+ FL_EXPORT ulong fl_xpixel(Fl_Color i);
+ FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
+ FL_EXPORT void fl_clip_region(Fl_Region);
+--- FL/Fl_Browser_.H
++++ FL/Fl_Browser_.H
+@@ -88,6 +88,7 @@
+ void new_list(); // completely clobber all data, as though list replaced
+ void deleting(void *a); // get rid of any pointers to a
+ void replacing(void *a,void *b); // change a pointers to b
++ void swapping(void *a,void *b); // exchange pointers a and b
+ void inserting(void *a,void *b); // insert b near a
+ int displayed(void *) const ; // true if this line is visible
+ void redraw_line(void *); // minimal update, no change in size
+--- FL/Fl_File_Chooser.H
++++ FL/Fl_File_Chooser.H
+@@ -145,6 +145,7 @@
+ void preview(int e);
+ int preview() const { return previewButton->value(); };
+ void rescan();
++ void rescan_keep_filename();
+ void show();
+ int shown();
+ void textcolor(Fl_Color c);
+--- src/Fl_File_Chooser.cxx
++++ src/Fl_File_Chooser.cxx
+@@ -375,7 +375,7 @@
+ window->show();
+ Fl::flush();
+ fl_cursor(FL_CURSOR_WAIT);
+-rescan();
++rescan_keep_filename();
+ fl_cursor(FL_CURSOR_DEFAULT);
+ fileName->take_focus();
+ }
+--- src/Fl_Browser.cxx
++++ src/Fl_Browser.cxx
+@@ -503,6 +503,7 @@
+ void Fl_Browser::swap(FL_BLINE *a, FL_BLINE *b) {
+
+ if ( a == b || !a || !b) return; // nothing to do
++ swapping(a, b);
+ FL_BLINE *aprev = a->prev;
+ FL_BLINE *anext = a->next;
+ FL_BLINE *bprev = b->prev;
+@@ -535,8 +536,6 @@
+ }
+ // Disable cache -- we played around with positions
+ cacheline = 0;
+- // Redraw modified lines
+- redraw_lines();
+ }
+
+ void Fl_Browser::swap(int ai, int bi) {
+--- src/Fl_Window.cxx
++++ src/Fl_Window.cxx
+@@ -36,7 +36,7 @@
+ #include "flstring.h"
+
+ #ifdef __APPLE_QUARTZ__
+-#include <FL/fl_draw.h>
++#include <FL/fl_draw.H>
+ #endif
+
+ void Fl_Window::_Fl_Window() {
+--- src/Fl_Font.H
++++ src/Fl_Font.H
+@@ -40,9 +40,9 @@
+
+ #include <config.h>
+
+-# if USE_XFT
++# if USE_XFT && !SUPPRESS_XFT
+ typedef struct _XftFont XftFont;
+-# endif // USE_XFT
++# endif // USE_XFT && !SUPPRESS_XFT
+
+ class Fl_FontSize {
+ public:
+@@ -63,7 +63,7 @@
+ char *q_name;
+ int size;
+ short ascent, descent, q_width;
+-# elif USE_XFT
++# elif USE_XFT && !SUPPRESS_XFT
+ XftFont* font;
+ const char* encoding;
+ int size;
+--- src/Fl_mac.cxx
++++ src/Fl_mac.cxx
+@@ -121,7 +121,7 @@
+ static unsigned short macKeyLookUp[128] =
+ {
+ 'a', 's', 'd', 'f', 'h', 'g', 'z', 'x',
+- 'c', 'v', 0/*ISO extra ('#' on German keyboard)*/, 'b', 'q', 'w', 'e', 'r',
++ 'c', 'v', '^', 'b', 'q', 'w', 'e', 'r',
+
+ 'y', 't', '1', '2', '3', '4', '6', '5',
+ '=', '9', '7', '-', '8', '0', ']', 'o',
+@@ -2159,14 +2159,15 @@
+ Size len = 0;
+ if (GetCurrentScrap(&scrap) == noErr && scrap != myScrap &&
+ GetScrapFlavorSize(scrap, kScrapFlavorTypeText, &len) == noErr) {
+- if ( len > fl_selection_buffer_length[1] ) {
++ if ( len >= fl_selection_buffer_length[1] ) {
+ fl_selection_buffer_length[1] = len + 32;
+ delete[] fl_selection_buffer[1];
+- fl_selection_buffer[1] = new char[len];
++ fl_selection_buffer[1] = new char[len + 32];
+ }
++ fl_selection_length[1] = len; len++;
+ GetScrapFlavorData( scrap, kScrapFlavorTypeText, &len,
+ fl_selection_buffer[1] );
+- fl_selection_length[1] = len;
++ fl_selection_buffer[1][fl_selection_length[1]] = 0;
+ // turn all \r characters into \n:
+ for (int x = 0; x < len; x++) {
+ if (fl_selection_buffer[1][x] == '\r')
+--- src/Fl_File_Chooser.fl
++++ src/Fl_File_Chooser.fl
+@@ -61,7 +61,7 @@
+ fileList->deselect();
+ Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
+ window->hide();}
+- private xywh {387 242 490 380} type Double resizable
++ private xywh {368 285 490 380} type Double resizable
+ code0 {if (title) window->label(title);}
+ code1 {\#include <stdio.h>}
+ code2 {\#include <stdlib.h>}
+@@ -138,7 +138,7 @@
+ if (callback_)
+ (*callback_)(this, data_);
+
+-window->hide();} selected
++window->hide();}
+ private xywh {313 345 85 25}
+ code0 {\#include <FL/fl_ask.H>}
+ code1 {okButton->label(fl_ok);}
+@@ -160,7 +160,7 @@
+ }
+ Fl_Window favWindow {
+ label {Manage Favorites}
+- private xywh {437 187 355 150} type Double resizable
++ private xywh {421 56 355 150} type Double resizable
+ code0 {favWindow->label(manage_favorites_label);} modal size_range {181 150 0 0} visible
+ } {
+ Fl_File_Browser favList {
+@@ -299,15 +299,18 @@
+ }
+ decl {void rescan();} {public
+ }
+- Function {show()} {return_type void
++ decl {void rescan_keep_filename();} {public
++ }
++ Function {show()} {open return_type void
+ } {
+ code {window->hotspot(fileList);
+ window->show();
+ Fl::flush();
+ fl_cursor(FL_CURSOR_WAIT);
+-rescan();
++rescan_keep_filename();
+ fl_cursor(FL_CURSOR_DEFAULT);
+-fileName->take_focus();} {}
++fileName->take_focus();} {selected
++ }
+ }
+ Function {shown()} {return_type int
+ } {
+--- src/Fl_Shared_Image.cxx
++++ src/Fl_Shared_Image.cxx
+@@ -227,7 +227,7 @@
+ fread(header, 1, sizeof(header), fp);
+ fclose(fp);
+ } else {
+- memset(header, 0, sizeof(header));
++ return;
+ }
+
+ // Load the image as appropriate...
+--- src/Fl_File_Chooser2.cxx
++++ src/Fl_File_Chooser2.cxx
+@@ -854,6 +854,57 @@
+ update_preview();
+ }
+
++//
++// 'Fl_File_Chooser::rescan_keep_filename()' - Rescan the current directory
++// without clearing the filename, then select the file if it is in the list
++//
++
++void
++Fl_File_Chooser::rescan_keep_filename()
++{
++ // if no filename was set, this is likely a diretory browser
++ const char *fn = fileName->value();
++ if (!fn || !*fn || fn[strlen(fn) - 1]=='/') {
++ rescan();
++ return;
++ }
++
++ int i;
++ char pathname[1024]; // New pathname for filename field
++ strlcpy(pathname, fn, sizeof(pathname));
++
++ // Build the file list...
++ fileList->load(directory_, sort);
++
++ // Update the preview box...
++ update_preview();
++
++ // and select the chosen file
++ char found = 0;
++ char *slash = strrchr(pathname, '/');
++ if (slash)
++ slash++;
++ else
++ slash = pathname;
++ for (i = 1; i <= fileList->size(); i ++)
++#if defined(WIN32) || defined(__EMX__)
++ if (strcasecmp(fileList->text(i), slash) == 0) {
++#else
++ if (strcmp(fileList->text(i), slash) == 0) {
++#endif // WIN32 || __EMX__
++ fileList->topline(i);
++ fileList->select(i);
++ found = 1;
++ break;
++ }
++
++ // update OK button activity
++ if (found || type_ & CREATE)
++ okButton->activate();
++ else
++ okButton->deactivate();
++}
++
+
+ //
+ // 'Fl_File_Chooser::showChoiceCB()' - Handle show selections.
+@@ -889,7 +940,7 @@
+
+ if (shown()) {
+ // Rescan the directory...
+- rescan();
++ rescan_keep_filename();
+ }
+ }
+
+--- src/fl_scroll_area.cxx
++++ src/fl_scroll_area.cxx
+@@ -32,6 +32,7 @@
+ #include <config.h>
+ #include <FL/Fl.H>
+ #include <FL/x.H>
++#include <FL/fl_draw.H>
+
+ // scroll a rectangle and redraw the newly exposed portions:
+ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
+--- src/Fl_Menu.cxx
++++ src/Fl_Menu.cxx
+@@ -107,6 +107,7 @@
+ int titlex(int);
+ void autoscroll(int);
+ void position(int x, int y);
++ int is_inside(int x, int y);
+ };
+
+ #define LEADING 4 // extra vertical leading
+@@ -458,6 +459,15 @@
+ return xx;
+ }
+
++// return 1, if the given root coordinates are inside the window
++int menuwindow::is_inside(int mx, int my) {
++ if ( mx < x_root() || mx >= x_root() + w() ||
++ my < y_root() || my >= y_root() + h()) {
++ return 0;
++ }
++ return 1;
++}
++
+ ////////////////////////////////////////////////////////////////
+ // Fl_Menu_Item::popup(...)
+
+@@ -488,9 +498,20 @@
+ int nummenus;
+ int menubar; // if true p[0] is a menubar
+ int state;
++ int is_inside(int mx, int my);
+ };
+ static menustate* p;
+
++// return 1 if the coordinates are inside any of the menuwindows
++int menustate::is_inside(int mx, int my) {
++ int i;
++ for (i=nummenus-1; i>=0; i--) {
++ if (p[i]->is_inside(mx, my))
++ return 1;
++ }
++ return 0;
++}
++
+ static inline void setitem(const Fl_Menu_Item* i, int m, int n) {
+ p->current_item = i;
+ p->menu_number = m;
+@@ -595,14 +616,11 @@
+ int mx = Fl::event_x_root();
+ int my = Fl::event_y_root();
+ int item=0; int mymenu = pp.nummenus-1;
+- if (e == FL_PUSH && (!pp.menubar || mymenu) &&
+- (mx < pp.p[mymenu]->x_root() ||
+- mx >= (pp.p[mymenu]->x_root() + pp.p[mymenu]->w()) ||
+- my < pp.p[mymenu]->y_root() ||
+- my >= (pp.p[mymenu]->y_root() + pp.p[mymenu]->h()))) {
+- // Clicking outside menu cancels it...
++ // Clicking or dragging outside menu cancels it...
++ if ((!pp.menubar || mymenu) && !pp.is_inside(mx, my)) {
+ setitem(0, -1, 0);
+- pp.state = DONE_STATE;
++ if (e==FL_PUSH)
++ pp.state = DONE_STATE;
+ return 1;
+ }
+ for (mymenu = pp.nummenus-1; ; mymenu--) {
+--- src/Fl_Browser_.cxx
++++ src/Fl_Browser_.cxx
+@@ -470,6 +470,15 @@
+ if (a == max_width_item) {max_width_item = 0; max_width = 0;}
+ }
+
++void Fl_Browser_::swapping(void* a, void* b) {
++ redraw_line(a);
++ redraw_line(b);
++ if (a == selection_) selection_ = b;
++ else if (b == selection_) selection_ = a;
++ if (a == top_) top_ = b;
++ else if (b == top_) top_ = a;
++}
++
+ void Fl_Browser_::inserting(void* a, void* b) {
+ if (displayed(a)) redraw_lines();
+ if (a == top_) top_ = b;
+--- src/Fl_File_Browser.cxx
++++ src/Fl_File_Browser.cxx
+@@ -467,7 +467,7 @@
+ {
+ sprintf(filename, "%c:/", i);
+
+- if (i < 'C')
++ if (i < 'C') // see also: GetDriveType and GetVolumeInformation in WIN32
+ add(filename, icon);
+ else
+ add(filename, icon);
+--- src/fl_font_xft.cxx
++++ src/fl_font_xft.cxx
+@@ -62,6 +62,52 @@
+ // are several web pages of information on how to do this.
+ //
+
++// kludge to pull in the Xlib code as a fallback
++#define Fl_FontSize Fl_Fontsize_xlib
++#define fl_fontsize fl_fontsize_xlib
++#define Fl_Fontdesc Fl_Fontdesc_xlib
++#define fl_fonts fl_fonts_xlib
++#define built_in_table built_in_table_xlib
++#define fl_font_word fl_font_word_xlib
++#define fl_find_fontsize fl_find_fontsize_xlib
++#define fl_encoding fl_encoding_xlib
++#define fl_correct_encoding fl_correct_encoding_xlib
++#define find find_xlib
++#define fl_font_ fl_font__xlib
++#define fl_size_ fl_size__xlib
++#define fl_xfont fl_xfont_xlib
++#define font_gc font_gc_xlib
++#define fl_font fl_font_xlib
++#define fl_height fl_height_xlib
++#define fl_descent fl_descent_xlib
++#define fl_width fl_width_xlib
++#define fl_draw fl_draw_xlib
++#define SUPPRESS_XFT 1
++#undef FL_FONT_
++#include "Fl_Font.H"
++#include "fl_font_x.cxx"
++#undef SUPPRESS_XFT
++#undef Fl_FontSize
++#undef fl_fontsize
++#undef Fl_Fontdesc
++#undef fl_fonts
++#undef built_in_table
++#undef fl_font_word
++#undef fl_find_fontsize
++#undef fl_encoding
++#undef fl_correct_encoding
++#undef find
++#undef fl_font_
++#undef fl_size_
++#undef fl_xfont
++#undef font_gc
++#undef fl_font
++#undef fl_height
++#undef fl_descent
++#undef fl_width
++#undef fl_draw
++
++
+ #include <X11/Xft/Xft.h>
+
+ // The predefined fonts that FLTK has:
+@@ -90,9 +136,10 @@
+
+ int fl_font_ = 0;
+ int fl_size_ = 0;
+-XFontStruct* fl_xfont = 0;
++Fl_XFont_On_Demand fl_xfont;
+ const char* fl_encoding_ = "iso8859-1";
+ Fl_FontSize* fl_fontsize = 0;
++XFontStruct* fl_xxfont();
+
+ void fl_font(int fnum, int size) {
+ if (fnum == fl_font_ && size == fl_size_ &&
+@@ -112,7 +159,9 @@
+ font->first = f;
+ }
+ fl_fontsize = f;
+-#if XFT_MAJOR < 2
++#if defined(XFT_MAJOR) && XFT_MAJOR >= 2
++ fl_xfont = fl_xxfont();
++#else
+ fl_xfont = f->font->u.core.font;
+ #endif // XFT_MAJOR < 2
+ }
+@@ -176,7 +225,6 @@
+ return fl_width((const char *)(&c), 1);
+ }
+
+-#if HAVE_GL
+ // This call is used by opengl to get a bitmapped font.
+ XFontStruct* fl_xxfont() {
+ # if XFT_MAJOR > 1
+@@ -192,7 +240,6 @@
+ return xftfont->u.core.font;
+ # endif // XFT_MAJOR > 1
+ }
+-#endif // HAVE_GL
+
+ #if USE_OVERLAY
+ // Currently Xft does not work with colormapped visuals, so this probably
+@@ -223,6 +270,15 @@
+ }
+
+ void fl_draw(const char *str, int n, int x, int y) {
++ if ( !current_font ) {
++ int saved_font = fl_font_, saved_size = fl_size_;
++ fl_font(FL_HELVETICA, 14);
++ if ( !current_font ) {
++ fl_font_xlib(saved_font, saved_size ? saved_size : fl_size_);
++ fl_draw_xlib(str, n, x, y);
++ return;
++ }
++ }
+ #if USE_OVERLAY
+ XftDraw*& draw = fl_overlay ? draw_overlay : ::draw;
+ if (fl_overlay) {
+--- test/preferences.fl
++++ test/preferences.fl
+@@ -69,7 +69,7 @@
+ }
+ }
+ Fl_Choice wWear {
+- label {Wear:} open
++ label {Wear:} open selected
+ xywh {25 100 105 20} down_box BORDER_BOX align 5
+ } {
+ MenuItem {} {
+@@ -93,15 +93,15 @@
+ xywh {35 120 98 60}
+ } {
+ Fl_Round_Button wLeft {
+- label {left side} selected
++ label {left side}
+ xywh {35 120 95 25} type Radio down_box ROUND_DOWN_BOX
+ }
+ Fl_Round_Button wRight {
+- label {right side} selected
++ label {right side}
+ xywh {35 140 95 25} type Radio down_box ROUND_DOWN_BOX
+ }
+ Fl_Box {} {
+- label {of the bed} selected
++ label {of the bed}
+ xywh {38 160 95 20}
+ }
+ }
+--- test/sudoku.cxx
++++ test/sudoku.cxx
+@@ -547,7 +547,7 @@
+ break;
+
+ case FL_PUSH :
+- if (Fl::event_inside(this)) {
++ if (!readonly() && Fl::event_inside(this)) {
+ if (Fl::event_clicks()) {
+ // 2+ clicks increments/sets value
+ if (value()) {