Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 99993 | Differences between
and this patch

Collapse All | Expand All

(-)flwm-1.02/configure.in (+12 lines)
Lines 13-18 Link Here
13
13
14
MAKEDEPEND="\$(CXX) -M"
14
MAKEDEPEND="\$(CXX) -M"
15
15
16
AC_PATH_PROG(FLTK,fltk-utf8-config)
17
if test "x$FLTK" == x; then
18
    AC_PATH_PROG(FLTK,fltk-config)
19
fi
20
21
if test "x$FLTK" != x; then
22
  CXXFLAGS="`$FLTK --cxxflags` $CXXFLAGS"
23
  LIBS="`$FLTK --ldflags` $LDFLAGS"
24
else
25
  die "no fltk-config found"
26
fi
27
16
dnl# add warnings and optimization to compiler switches:
28
dnl# add warnings and optimization to compiler switches:
17
dnl# do this last so messing with switches does not break tests
29
dnl# do this last so messing with switches does not break tests
18
if test -n "$GXX"; then
30
if test -n "$GXX"; then
(-)flwm-1.02/Frame.C (-5 / +27 lines)
Lines 5-12 Link Here
5
#include "Desktop.H"
5
#include "Desktop.H"
6
#include <string.h>
6
#include <string.h>
7
#include <stdio.h>
7
#include <stdio.h>
8
#include <stdlib.h>
8
#include <FL/fl_draw.H>
9
#include <FL/fl_draw.H>
9
#include "Rotated.H"
10
#include "Rotated_xft.H"
10
11
11
12
12
static Atom wm_state = 0;
13
static Atom wm_state = 0;
Lines 481-497 Link Here
481
482
482
void Frame::getLabel(int del) {
483
void Frame::getLabel(int del) {
483
  char* old = (char*)label();
484
  char* old = (char*)label();
484
  char* nu = del ? 0 : (char*)getProperty(XA_WM_NAME);
485
  //char* nu = del ? 0 : (char*)getProperty(XA_WM_NAME);
486
  char* nu=0;// = del ? 0 : (char*)getProperty(XA_WM_NAME);
487
  if(!del){
488
  /*XGetIconName(fl_display,window_,&nu);
489
    printf("icon %s\n",nu);
490
    XFree(nu);nu=0;*/
491
    XTextProperty prop;
492
    if(XGetWMName(fl_display,window_,&prop)){
493
      if(NULL!= prop.value && 0!=prop.nitems){
494
        //printf("icon %d\n",prop.nitems);
495
        
496
        char **strs;int count;
497
        int ret = XmbTextPropertyToTextList(fl_display,&prop,&strs,&count);
498
        if(ret>=0 && strs[0] && count >0)nu=strdup(strs[0]);
499
        else nu=strdup((char*)prop.value);
500
//	printf("%s\n",nu);
501
        if(strs)XFreeStringList(strs);
502
        XFree(prop.value);
503
      }	
504
  }
505
  //nu=(char*)prop.value;
506
  }
485
  if (nu) {
507
  if (nu) {
486
    // since many window managers print a default label when none is
508
    // since many window managers print a default label when none is
487
    // given, many programs send spaces to make a blank label.  Detect
509
    // given, many programs send spaces to make a blank label.  Detect
488
    // this and make it really be blank:
510
    // this and make it really be blank:
489
    char* c = nu; while (*c == ' ') c++;
511
    char* c = nu; while (*c == ' ') c++;
490
    if (!*c) {XFree(nu); nu = 0;}
512
    if (!*c) {free(nu); nu = 0;}
491
  }
513
  }
492
  if (old) {
514
  if (old) {
493
    if (nu && !strcmp(old,nu)) {XFree(nu); return;}
515
    if (nu && !strcmp(old,nu)) {free(nu); return;}
494
    XFree(old);
516
    free(old);
495
  } else {
517
  } else {
496
    if (!nu) return;
518
    if (!nu) return;
497
  }
519
  }
(-)flwm-1.02/Makefile (-4 / +4 lines)
Lines 3-11 Link Here
3
PROGRAM = flwm
3
PROGRAM = flwm
4
VERSION = 1.02
4
VERSION = 1.02
5
5
6
CXXFILES = main.C Frame.C Rotated.C Menu.C FrameWindow.C Desktop.C Hotkeys.C
6
CXXFILES = main.C Frame.C Rotated_xft.C Menu.C FrameWindow.C Desktop.C Hotkeys.C
7
7
8
LIBS = -lfltk
8
#LIBS = -lfltk
9
9
10
MANPAGE = 1
10
MANPAGE = 1
11
11
Lines 80-84 Link Here
80
$(PROGRAM_D) : $(OBJECTS_D)
80
$(PROGRAM_D) : $(OBJECTS_D)
81
	$(CXX) $(LDFLAGS) -o $(PROGRAM_D) $(OBJECTS_D) $(LIBS) $(LDLIBS)
81
	$(CXX) $(LDFLAGS) -o $(PROGRAM_D) $(OBJECTS_D) $(LIBS) $(LDLIBS)
82
82
83
rotated_test: Rotated.o rotated_test.C
83
rotated_test: Rotated_xft.o rotated_test.C
84
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o rotated_test rotated_test.C Rotated.o $(LIBS) $(LDLIBS)
84
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o rotated_test rotated_test.C Rotated_xft.o $(LIBS)  -lfltk-utf8_forms $(LDLIBS) -lfltk-utf8_forms
(-)flwm-1.02/rotated_test.C (-14 / +50 lines)
Lines 11-30 Link Here
11
11
12
////////////////////////////////////////////////////////////////
12
////////////////////////////////////////////////////////////////
13
13
14
#include "Rotated.H"
14
#include "Rotated_xft.H"
15
15
16
class RotText : public Fl_Box {
16
class RotText : public Fl_Box {
17
  void draw();
17
  void draw();
18
public:
18
public:
19
  int angle;
20
  int aligned;
19
  RotText(int X, int Y, int W, int H, const char* L = 0) :
21
  RotText(int X, int Y, int W, int H, const char* L = 0) :
20
    Fl_Box(X,Y,W,H,L) {}
22
    Fl_Box(X,Y,W,H,L),angle(90){}
21
};
23
};
22
24
23
void RotText::draw() {
25
void RotText::draw() {
24
  draw_box();
26
  draw_box();
25
  fl_color(FL_BLACK);
27
  fl_color(FL_BLACK);
26
  fl_font(labelfont(), labelsize());
28
  fl_font(labelfont(), labelsize());
27
  draw_rotated90(label(), x(), y(), w(), h(), align());
29
  if(aligned){
30
    if(angle%360==0)fl_draw(label(), x(), y(), w(), h(), align());
31
    else if(angle%360==90)draw_rotated90(label(), x(), y(), w(), h(), align());
32
    else if(angle%360==180)draw_rotated180(label(), x(), y(), w(), h(), align());
33
    else if(angle%360==270)draw_rotated270(label(), x(), y(), w(), h(), align());
34
  }
35
  else draw_rotated(label(), x()+w()/2, y()+h()/2,angle);
28
}
36
}
29
37
30
////////////////////////////////////////////////////////////////
38
////////////////////////////////////////////////////////////////
Lines 34-39 Link Here
34
Fl_Input *input;
42
Fl_Input *input;
35
Fl_Hor_Value_Slider *fonts;
43
Fl_Hor_Value_Slider *fonts;
36
Fl_Hor_Value_Slider *sizes;
44
Fl_Hor_Value_Slider *sizes;
45
Fl_Hor_Value_Slider *angle;
37
Fl_Double_Window *window;
46
Fl_Double_Window *window;
38
47
39
void button_cb(Fl_Widget *,void *) {
48
void button_cb(Fl_Widget *,void *) {
Lines 59-106 Link Here
59
  window->redraw();
68
  window->redraw();
60
}
69
}
61
70
71
void cb_aligned(Fl_Button *o,void *) {
72
  text->aligned=o->value();
73
  if(text->aligned){
74
    angle->value(text->angle-text->angle%90);
75
    angle->step(90);
76
  }else{
77
    angle->step(1);
78
  }
79
  window->redraw();
80
}
81
82
void angle_cb(Fl_Widget *,void *) {
83
  text->angle=(int(angle->value()));
84
  window->redraw();
85
}
86
62
void input_cb(Fl_Widget *,void *) {
87
void input_cb(Fl_Widget *,void *) {
63
  text->label(input->value());
88
  text->label(input->value());
64
  window->redraw();
89
  window->redraw();
65
}
90
}
66
91
67
int main(int argc, char **argv) {
92
int main(int argc, char **argv) {
68
  window = new Fl_Double_Window(400,400);
93
  window = new Fl_Double_Window(450,425);
69
94
70
  input = new Fl_Input(50,0,350,25);
95
  input = new Fl_Input(50,0,375,25);
71
  input->static_value("The quick brown fox jumped over the lazy dog.");
96
  input->static_value("The quick brown fox jumped over the lazy dog.");
72
  input->when(FL_WHEN_CHANGED);
97
  input->when(FL_WHEN_CHANGED);
73
  input->callback(input_cb);
98
  input->callback(input_cb);
74
99
75
  sizes= new Fl_Hor_Value_Slider(50,25,350,25,"Size:");
100
  angle = new Fl_Hor_Value_Slider(50,25,400,25,"Angle:");
101
  angle->align(FL_ALIGN_LEFT);
102
  angle->bounds(0,360);
103
  angle->step(1);
104
  angle->value(90);
105
  angle->callback(angle_cb);
106
107
  sizes= new Fl_Hor_Value_Slider(50,50,400,25,"Size:");
76
  sizes->align(FL_ALIGN_LEFT);
108
  sizes->align(FL_ALIGN_LEFT);
77
  sizes->bounds(1,64);
109
  sizes->bounds(1,64);
78
  sizes->step(1);
110
  sizes->step(1);
79
  sizes->value(14);
111
  sizes->value(14);
80
  sizes->callback(size_cb);
112
  sizes->callback(size_cb);
81
113
82
  fonts=new Fl_Hor_Value_Slider(50,50,350,25,"Font:");
114
  fonts=new Fl_Hor_Value_Slider(50,75,400,25,"Font:");
83
  fonts->align(FL_ALIGN_LEFT);
115
  fonts->align(FL_ALIGN_LEFT);
84
  fonts->bounds(0,15);
116
  fonts->bounds(0,15);
85
  fonts->step(1);
117
  fonts->step(1);
86
  fonts->value(0);
118
  fonts->value(0);
87
  fonts->callback(font_cb);
119
  fonts->callback(font_cb);
88
120
121
89
  Fl_Group *g = new Fl_Group(0,0,0,0);
122
  Fl_Group *g = new Fl_Group(0,0,0,0);
90
  leftb = new Fl_Toggle_Button(50,75,50,25,"left");
123
  leftb = new Fl_Toggle_Button(50,100,50,25,"left");
91
  leftb->callback(button_cb);
124
  leftb->callback(button_cb);
92
  rightb = new Fl_Toggle_Button(100,75,50,25,"right");
125
  rightb = new Fl_Toggle_Button(100,100,50,25,"right");
93
  rightb->callback(button_cb);
126
  rightb->callback(button_cb);
94
  topb = new Fl_Toggle_Button(150,75,50,25,"top");
127
  topb = new Fl_Toggle_Button(150,100,50,25,"top");
95
  topb->callback(button_cb);
128
  topb->callback(button_cb);
96
  bottomb = new Fl_Toggle_Button(200,75,50,25,"bottom");
129
  bottomb = new Fl_Toggle_Button(200,100,50,25,"bottom");
97
  bottomb->callback(button_cb);
130
  bottomb->callback(button_cb);
98
  insideb = new Fl_Toggle_Button(250,75,50,25,"inside");
131
  insideb = new Fl_Toggle_Button(250,100,50,25,"inside");
99
  insideb->callback(button_cb);
132
  insideb->callback(button_cb);
100
  wrapb = new Fl_Toggle_Button(300,75,50,25,"wrap");
133
  wrapb = new Fl_Toggle_Button(300,100,50,25,"wrap");
101
  wrapb->callback(button_cb);
134
  wrapb->callback(button_cb);
102
  clipb = new Fl_Toggle_Button(350,75,50,25,"clip");
135
  clipb = new Fl_Toggle_Button(350,100,50,25,"clip");
103
  clipb->callback(button_cb);
136
  clipb->callback(button_cb);
137
  Fl_Toggle_Button* bt_align=new Fl_Toggle_Button(400,100,50,25,"by 90");
138
  bt_align->callback((Fl_Callback*)cb_aligned);
139
  bt_align->value(0);
104
  g->resizable(insideb);
140
  g->resizable(insideb);
105
  g->forms_end();
141
  g->forms_end();
106
142
(-)flwm-1.02/Rotated_xft.C (+123 lines)
Line 0 Link Here
1
// Rotated text drawing with Xft.
2
3
// Original code:
4
// for FL_ALIGNMENT
5
// Copyright (c) 1997 Bill Spitzak (spitzak@d2.com)
6
// 
7
// Xft code:
8
// Yuri Fedorchenko 2007
9
// (work with patchet fltk version)
10
11
12
#include <FL/x.H>
13
#include <FL/fl_draw.H>
14
#include "Rotated_xft.H"
15
#include <stdlib.h>
16
#include <string.h>
17
#include <stdio.h>
18
19
20
void draw_rotated(const char* text, int n, int x, int y, int angle) {
21
  if (!text || !*text) return;
22
  /* make angle positive ... */
23
  if (angle < 0) do angle += 360; while (angle < 0);
24
  if (angle >=360)do angle -= 360; while (angle >=360);
25
  /* get nearest vertical or horizontal direction ... */
26
  int dir = ((angle+45)/90)%4;
27
#ifndef WIN32
28
  int as=fl_angle();
29
  fl_font(fl_font(),fl_size(),angle);
30
  fl_draw(text,n,x,y);
31
  fl_font(fl_font(),fl_size(),as);
32
#else
33
    f_name=built_in_table[fl_font()].name;
34
    int weight = FW_NORMAL;
35
    int italic = 0;
36
  if(!f_name)f_name="Arial";
37
    switch (*f_name++) {
38
    case 'I': italic = 1; break;
39
    case 'P': italic = 1;
40
    case 'B': weight = FW_BOLD; break;
41
    case ' ': break;
42
    default: f_name--;
43
    }
44
    //printf("angle %d\n",angle);
45
    HFONT fid = CreateFont(
46
    -fl_size(), // negative makes it use "char size"
47
    0,	            // logical average character width 
48
    angle*10.,	            // angle of escapement 
49
    angle*10.,	            // base-line orientation angle 
50
    weight,
51
    italic,
52
    FALSE,	        // underline attribute flag 
53
    FALSE,	        // strikeout attribute flag 
54
    DEFAULT_CHARSET,    // character set identifier 
55
    OUT_DEFAULT_PRECIS,	// output precision 
56
    CLIP_DEFAULT_PRECIS,// clipping precision 
57
    DEFAULT_QUALITY,	// output quality 
58
    DEFAULT_PITCH,	// pitch and family 
59
    f_name	        // pointer to typeface name string 
60
    );
61
    if (!fl_gc) fl_GetDC(0);
62
    COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
63
    SelectObject(fl_gc, fid);
64
    TextOut(fl_gc, x, y, text, n);
65
    SetTextColor(fl_gc, oldColor);
66
    DeleteObject(fid);
67
#endif
68
}
69
70
void draw_rotated(const char* text, int x, int y, int angle) {
71
  if (!text || !*text) return;
72
  draw_rotated(text, strlen(text), x, y, angle);
73
}
74
75
void draw_rot90(const char* str, int n, int x, int y) {
76
  draw_rotated(str, n, y, -x, 90);
77
}
78
void draw_rotated90(
79
  const char* str, 	// the (multi-line) string
80
  int x, int y, int w, int h, 	// bounding box
81
  Fl_Align align,Fl_Image* img) {
82
  if (!str || !*str) return;
83
  if (w && h && !fl_not_clipped(x, y, w, h)) return;
84
  if (align & FL_ALIGN_CLIP) fl_clip(x, y, w, h);
85
  int a1 = align&(-16);
86
  if (align & FL_ALIGN_LEFT) a1 |= FL_ALIGN_TOP;
87
  if (align & FL_ALIGN_RIGHT) a1 |= FL_ALIGN_BOTTOM;
88
  if (align & FL_ALIGN_TOP) a1 |= FL_ALIGN_RIGHT;
89
  if (align & FL_ALIGN_BOTTOM) a1 |= FL_ALIGN_LEFT;
90
  fl_draw(str, -(y+h), x, h, w, (Fl_Align)a1, draw_rot90,img);
91
  if (align & FL_ALIGN_CLIP) fl_pop_clip();
92
}
93
94
static void draw_rot180(const char* str, int n, int x, int y) {
95
  draw_rotated(str, n, -x, -y, 180);
96
}
97
void draw_rotated180(
98
  const char* str, 	// the (multi-line) string
99
  int x, int y, int w, int h, 	// bounding box
100
  Fl_Align align,Fl_Image* img) {
101
  int a1 = align&(-16);
102
  if (align & FL_ALIGN_LEFT) a1 |= FL_ALIGN_RIGHT;
103
  if (align & FL_ALIGN_RIGHT) a1 |= FL_ALIGN_LEFT;
104
  if (align & FL_ALIGN_TOP) a1 |= FL_ALIGN_BOTTOM;
105
  if (align & FL_ALIGN_BOTTOM) a1 |= FL_ALIGN_TOP;
106
  fl_draw(str, -(x+w), -(y+h), w, h, (Fl_Align)a1, draw_rot180,img);
107
}
108
109
static void draw_rot270(const char* str, int n, int x, int y) {
110
  draw_rotated(str, n, -y, x, 270);
111
}
112
void draw_rotated270(
113
  const char* str, 	// the (multi-line) string
114
  int x, int y, int w, int h, 	// bounding box
115
  Fl_Align align,Fl_Image* img) {
116
  int a1 = align&(-16);
117
  if (align & FL_ALIGN_LEFT) a1 |= FL_ALIGN_BOTTOM;
118
  if (align & FL_ALIGN_RIGHT) a1 |= FL_ALIGN_TOP;
119
  if (align & FL_ALIGN_TOP) a1 |= FL_ALIGN_LEFT;
120
  if (align & FL_ALIGN_BOTTOM) a1 |= FL_ALIGN_RIGHT;
121
  fl_draw(str, y, -(x+w), h, w, (Fl_Align)a1, draw_rot270,img);
122
}
123
(-)flwm-1.02/Rotated_xft.H (+15 lines)
Line 0 Link Here
1
// Rotated text drawing with Xft.
2
3
// Yury Fedorchenko 2007
4
5
#ifndef Rotated_H
6
#define Rotated_H
7
8
9
void draw_rotated(const char* text, int n, int x, int y, int angle);
10
void draw_rotated(const char* text, int x, int y, int angle);
11
void draw_rotated90(const char*, int x, int y, int w, int h, Fl_Align,Fl_Image* img=0);
12
void draw_rotated270(const char*, int x, int y, int w, int h, Fl_Align,Fl_Image* img=0);
13
void draw_rotated180(const char*, int x, int y, int w, int h, Fl_Align,Fl_Image* img=0);
14
15
#endif 

Return to bug 99993