Commit 91a02b6e authored by Axel Beckert's avatar Axel Beckert

Imported Upstream version 1.02+git2015.04.29

parent 5cef9b37
// Frame.C
#define FL_INTERNALS 1
#include "config.h"
#include "Frame.H"
#include "Desktop.H"
#include <string.h>
#include <stdio.h>
#include <FL/fl_draw.H>
#include "Rotated.H"
static Atom wm_state = 0;
static Atom wm_change_state;
......@@ -915,7 +914,7 @@ void Frame::raise() {
// preserving stacking order:
for (p = &first; *p;) {
Frame* f = *p;
if (f == this || f->is_transient_for(this) && f->state() != UNMAPPED) {
if (f == this || (f->is_transient_for(this) && f->state() != UNMAPPED)) {
*p = f->next; // remove it from list
if (previous) {
XWindowChanges w;
......@@ -970,7 +969,7 @@ void Frame::lower() {
void Frame::iconize() {
for (Frame* c = first; c; c = c->next) {
if (c == this || c->is_transient_for(this) && c->state() != UNMAPPED)
if (c == this || (c->is_transient_for(this) && c->state() != UNMAPPED))
c->state(ICONIC);
}
}
......@@ -1163,7 +1162,7 @@ void Frame::show_hide_buttons() {
#endif
}
if (min_h == max_h || flag(KEEP_ASPECT|NO_RESIZE) ||
!max_h_button.value() && by+label_w+2*BUTTON_H > h()-BUTTON_BOTTOM) {
(!max_h_button.value() && by+label_w+2*BUTTON_H > h()-BUTTON_BOTTOM)) {
max_h_button.hide();
} else {
max_h_button.position(BUTTON_LEFT,by);
......@@ -1171,7 +1170,7 @@ void Frame::show_hide_buttons() {
by += BUTTON_H;
}
if (min_w == max_w || flag(KEEP_ASPECT|NO_RESIZE) ||
!max_w_button.value() && by+label_w+2*BUTTON_H > h()-BUTTON_BOTTOM) {
(!max_w_button.value() && by+label_w+2*BUTTON_H > h()-BUTTON_BOTTOM)) {
max_w_button.hide();
} else {
max_w_button.position(BUTTON_LEFT,by);
......@@ -1256,6 +1255,7 @@ void Frame::draw() {
fl_frame("AAAAWWJJTTNN",0,0,w(),h());
#endif
if (!flag(THIN_BORDER) && label_h > 3) {
fl_push_clip(1, label_y, left, label_h);
#ifdef SHOW_CLOCK
if (active()) {
int clkw = int(fl_width(clock_buf));
......@@ -1274,8 +1274,9 @@ void Frame::draw() {
// and the window height is short enough. For now, we'll
// assume this is not enough of a problem to be concerned
// about.
draw_rotated90(clock_buf, 1, label_y+3, left-1, label_h-6,
Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_CLIP));
fl_draw(90, clock_buf,
(left + fl_height() + 1)/2 - fl_descent(),
label_y+label_h-3);
} else
// Only show the clock on the active frame.
XClearArea(fl_display, fl_xid(this), 1, label_y+3,
......@@ -1283,8 +1284,10 @@ void Frame::draw() {
#endif
fl_color(labelcolor());
fl_font(TITLE_FONT_SLOT, TITLE_FONT_SIZE);
draw_rotated90(label(), 1, label_y+3, left-1, label_h-3,
Fl_Align(FL_ALIGN_TOP|FL_ALIGN_CLIP));
fl_draw(90, label(),
(left + fl_height() + 1)/2 - fl_descent(),
label_y+3+fl_width(label()));
fl_pop_clip();
}
}
}
......@@ -1646,8 +1649,8 @@ int Frame::handle(int e) {
nh = iy+ih-(Fl::event_y_root()-dy);
else {ny = y(); nh = h();}
if (flag(KEEP_ASPECT)) {
if (nw-dwidth > nh-dwidth
&& (what&(FL_ALIGN_LEFT|FL_ALIGN_RIGHT))
if ((nw-dwidth > nh-dwidth
&& (what&(FL_ALIGN_LEFT|FL_ALIGN_RIGHT)))
|| !(what&(FL_ALIGN_TOP|FL_ALIGN_BOTTOM)))
nh = nw-dwidth+dheight;
else
......
......@@ -182,8 +182,8 @@ int test_shortcut(int shortcut) {
int Handle_Hotkey() {
for (int i = 0; keybindings[i].key; i++) {
if (Fl::test_shortcut(keybindings[i].key) ||
(keybindings[i].key & 0xFFFF) == FL_Delete
&& Fl::event_key() == FL_BackSpace// fltk bug?
((keybindings[i].key & 0xFFFF) == FL_Delete
&& Fl::event_key() == FL_BackSpace)// fltk bug?
) {
keybindings[i].func();
return 1;
......
SHELL=/bin/sh
PROGRAM = flwm
VERSION = 1.02
VERSION = 1.02+git2015.04.29
CXXFILES = main.C Frame.C Rotated.C Menu.C FrameWindow.C Desktop.C Hotkeys.C
CXXFILES = main.C Frame.C Menu.C FrameWindow.C Desktop.C Hotkeys.C
MANPAGE = 1
......@@ -16,16 +16,19 @@ all: makeinclude $(PROGRAM)
$(PROGRAM) : $(OBJECTS)
$(CXX) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) $(LIBS)
makeinclude: configure
configure: configure.in
autoconf
makeinclude: configure makeinclude.in
./configure
include makeinclude
.SUFFIXES : .fl .do .C .c .H
.C.o :
$(CXX) $(CXXFLAGS) -c $<
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
.C :
$(CXX) $(CXXFLAGS) -c $<
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
.fl.C :
-fluid -c $<
.fl.H :
......@@ -77,6 +80,3 @@ OBJECTS_D = $(CXXFILES:.C=.do) $(CFILES:.c=.do)
$(PROGRAM_D) : $(OBJECTS_D)
$(CXX) $(LDFLAGS) -o $(PROGRAM_D) $(OBJECTS_D) $(LIBS)
rotated_test: Rotated.o rotated_test.C
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o rotated_test rotated_test.C Rotated.o $(LIBS) $(LIBS)
......@@ -568,7 +568,7 @@ ShowTabMenu(int tab)
if (d == Desktop::current()) first_on_desk = menu+n;
for (c = Frame::first; c; c = c->next) {
if (c->state() == UNMAPPED || c->transient_for()) continue;
if (c->desktop() == d || !c->desktop() && d == Desktop::current()) {
if (c->desktop() == d || (!c->desktop() && d == Desktop::current())) {
init(menu[n],(char*)c);
#if FL_MAJOR_VERSION < 2
init(menu[n],(char*)c);
......
This diff is collapsed.
// Rotated text drawing with X.
// Original code:
// Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) */
//
// Modifications for fltk:
// Copyright (c) 1997 Bill Spitzak (spitzak@d2.com)
#ifndef Rotated_H
#define Rotated_H
void draw_rotated(const char* text, int n, int x, int y, int angle);
void draw_rotated(const char* text, int x, int y, int angle);
void draw_rotated90(const char*, int x, int y, int w, int h, Fl_Align);
void draw_rotated270(const char*, int x, int y, int w, int h, Fl_Align);
void draw_rotated180(const char*, int x, int y, int w, int h, Fl_Align);
#endif
This diff is collapsed.
......@@ -7,7 +7,6 @@ AC_PROG_CXX
AC_PROG_INSTALL
AC_PATH_XTRA
echo "Ignoring libraries \"$X_PRE_LIBS\" requested by configure."
dnl# LIBS="$LIBS$X_LIBS$X_PRE_LIBS"
LIBS="$LIBS$X_LIBS"
......
// Define "TEST" and it will compile to make a single fake window so
// you can test the window controls.
//#define TEST 1
#define FL_INTERNALS 1
#include "Frame.H"
#include <X11/Xproto.h>
#include <stdio.h>
......@@ -214,27 +211,30 @@ extern FL_API fltk::Color fl_cursor_bg;
#else
static int cursor = FL_CURSOR_ARROW;
#endif
bool test_mode = false;
static void initialize() {
Display* d = fl_display;
#ifdef TEST
XWindow w = XCreateSimpleWindow(d, RootWindow(d, fl_screen),
100, 100, 200, 300, 10,
BlackPixel(fl_display, 0),
// WhitePixel(fl_display, 0));
0x1234);
Frame* frame = new Frame(w);
frame->label("flwm test window");
XSelectInput(d, w,
ExposureMask | StructureNotifyMask |
KeyPressMask | KeyReleaseMask | FocusChangeMask |
KeymapStateMask |
ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask /*|PointerMotionMask*/
);
#else
if (test_mode) {
XWindow w = XCreateSimpleWindow(d, RootWindow(d, fl_screen),
100, 100, 200, 300, 10,
BlackPixel(fl_display, 0),
// WhitePixel(fl_display, 0));
0x1234);
Frame* frame = new Frame(w);
frame->label("flwm test window");
XSelectInput(d, w,
ExposureMask | StructureNotifyMask |
KeyPressMask | KeyReleaseMask | FocusChangeMask |
KeymapStateMask |
ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask /*|PointerMotionMask*/
);
return;
}
Fl::add_handler(flwm_event_handler);
......@@ -315,8 +315,6 @@ static void initialize() {
(void)new Frame(wins[i],&attr);
}
XFree((void *)wins);
#endif
}
////////////////////////////////////////////////////////////////
......@@ -336,6 +334,10 @@ int arg(int argc, char **argv, int &i) {
exit_flag = 1;
i++;
return 1;
} else if (!strcmp(s, "test")) {
test_mode = true;
i++;
return 1;
}
// do switches with a value:
......@@ -397,6 +399,7 @@ int main(int argc, char** argv) {
" -c[ursor] #\t\tCursor number for root\n"
" -cfg color\t\tCursor color\n"
" -cbg color\t\tCursor outline color"
" -test\t\t\tTest the window graphics"
);
#ifndef FL_NORMAL_SIZE // detect new versions of fltk where this is a variable
FL_NORMAL_SIZE = 12;
......
......@@ -8,6 +8,7 @@ includedir =@includedir@
libdir =@libdir@
srcdir =@srcdir@
VPATH =@srcdir@
datarootdir =@datarootdir@
# compiler names:
CXX =@CXX@
......
// Test the xvertext routines for rotated text
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Hor_Value_Slider.H>
#include <FL/Fl_Toggle_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Choice.H>
#include <FL/fl_draw.H>
////////////////////////////////////////////////////////////////
#include "Rotated.H"
class RotText : public Fl_Box {
void draw();
public:
RotText(int X, int Y, int W, int H, const char* L = 0) :
Fl_Box(X,Y,W,H,L) {}
};
void RotText::draw() {
draw_box();
fl_color(FL_BLACK);
fl_font(labelfont(), labelsize());
draw_rotated90(label(), x(), y(), w(), h(), align());
}
////////////////////////////////////////////////////////////////
Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*clipb,*wrapb;
RotText *text;
Fl_Input *input;
Fl_Hor_Value_Slider *fonts;
Fl_Hor_Value_Slider *sizes;
Fl_Double_Window *window;
void button_cb(Fl_Widget *,void *) {
int i = 0;
if (leftb->value()) i |= FL_ALIGN_LEFT;
if (rightb->value()) i |= FL_ALIGN_RIGHT;
if (topb->value()) i |= FL_ALIGN_TOP;
if (bottomb->value()) i |= FL_ALIGN_BOTTOM;
if (insideb->value()) i |= FL_ALIGN_INSIDE;
if (clipb->value()) i |= FL_ALIGN_CLIP;
if (wrapb->value()) i |= FL_ALIGN_WRAP;
text->align(i);
window->redraw();
}
void font_cb(Fl_Widget *,void *) {
text->labelfont(int(fonts->value()));
window->redraw();
}
void size_cb(Fl_Widget *,void *) {
text->labelsize(int(sizes->value()));
window->redraw();
}
void input_cb(Fl_Widget *,void *) {
text->label(input->value());
window->redraw();
}
int main(int argc, char **argv) {
window = new Fl_Double_Window(400,400);
input = new Fl_Input(50,0,350,25);
input->static_value("The quick brown fox jumped over the lazy dog.");
input->when(FL_WHEN_CHANGED);
input->callback(input_cb);
sizes= new Fl_Hor_Value_Slider(50,25,350,25,"Size:");
sizes->align(FL_ALIGN_LEFT);
sizes->bounds(1,64);
sizes->step(1);
sizes->value(14);
sizes->callback(size_cb);
fonts=new Fl_Hor_Value_Slider(50,50,350,25,"Font:");
fonts->align(FL_ALIGN_LEFT);
fonts->bounds(0,15);
fonts->step(1);
fonts->value(0);
fonts->callback(font_cb);
Fl_Group *g = new Fl_Group(0,0,0,0);
leftb = new Fl_Toggle_Button(50,75,50,25,"left");
leftb->callback(button_cb);
rightb = new Fl_Toggle_Button(100,75,50,25,"right");
rightb->callback(button_cb);
topb = new Fl_Toggle_Button(150,75,50,25,"top");
topb->callback(button_cb);
bottomb = new Fl_Toggle_Button(200,75,50,25,"bottom");
bottomb->callback(button_cb);
insideb = new Fl_Toggle_Button(250,75,50,25,"inside");
insideb->callback(button_cb);
wrapb = new Fl_Toggle_Button(300,75,50,25,"wrap");
wrapb->callback(button_cb);
clipb = new Fl_Toggle_Button(350,75,50,25,"clip");
clipb->callback(button_cb);
g->resizable(insideb);
g->forms_end();
text= new RotText(100,225,200,100,input->value());
text->box(FL_FRAME_BOX);
text->align(FL_ALIGN_CENTER);
window->resizable(text);
window->forms_end();
window->show(argc,argv);
return Fl::run();
}
//
// End of "$Id: rotated_test.C,v 1.1 2000/01/18 01:05:49 spitzak Exp $".
//
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment