~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/editscreen.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: editscreen.c,v 1.57 2004/01/13 14:50:44 phase Exp $
 
2
 * $Id: editscreen.c,v 1.101 2005/05/24 19:33:04 ton Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
36
36
#include <config.h>
37
37
#endif
38
38
 
39
 
#ifdef WIN32
40
 
#include "BLI_winstuff.h"
41
 
#endif   
42
 
 
43
39
#include "nla.h"
44
40
 
45
41
#include <stdlib.h>
96
92
#include "BSE_edit.h"
97
93
#include "BSE_filesel.h"
98
94
#include "BSE_headerbuttons.h"
 
95
#include "BSE_seqaudio.h"
99
96
#include "BSE_view.h"
100
97
 
 
98
#include "BPY_extern.h"
101
99
#include "mydevice.h"
102
100
#include "blendef.h"
103
 
#include "render.h"
 
101
#include "render.h"             /* R.flag */
104
102
 
105
103
#include "winlay.h"
106
104
 
127
125
short winqueue_break= 0;
128
126
ScrArea *curarea= 0;
129
127
 
 
128
/* prototypes -------------------*/
 
129
int afterqtest(short win, unsigned short evt);
 
130
unsigned short screen_qread(short *val, char *ascii);
 
131
void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char ascii);
 
132
static void drawscredge_area(ScrArea *sa);
 
133
 
130
134
/**********************************************************************/
131
135
 
132
136
static void screen_set_cursor(bScreen *sc) 
191
195
        getmouse(mval);
192
196
}
193
197
 
 
198
/* mouse_cursor called during a script (via Window.QHandle) need
 
199
 * this function for getmouseco_areawin to work: */
 
200
void set_g_activearea(ScrArea *sa)
 
201
{
 
202
        if (sa) g_activearea = sa;
 
203
}
 
204
 
194
205
void getmouseco_areawin(short *mval)            /* internal area coordinates */
195
206
{
196
207
        getmouseco_sc(mval);
211
222
        }
212
223
}
213
224
 
 
225
void headerprint(char *str)
 
226
{
 
227
        if(curarea->headertype) {
 
228
                areawinset(curarea->headwin);
 
229
                
 
230
                headerbox(curarea);
 
231
                cpack(0x0);
 
232
                glRasterPos2i(20+curarea->headbutofs,  6);
 
233
                BMF_DrawString(G.font, str);
 
234
                
 
235
                curarea->head_swap= WIN_BACK_OK;
 
236
                areawinset(curarea->win);
 
237
        }
 
238
        else {
 
239
                // dunno... thats for later (ton)
 
240
        }
 
241
}
 
242
 
214
243
/* *********** STUFF ************** */
215
244
 
216
245
static int scredge_is_horizontal(ScrEdge *se)
292
321
                        G.snla= curarea->spacedata.first;
293
322
                        G.v2d= &G.snla->v2d;
294
323
                        break;
 
324
                case SPACE_TIME:
 
325
                        {
 
326
                        SpaceTime *stime= curarea->spacedata.first;
 
327
                        G.v2d= &stime->v2d;
 
328
                        }
 
329
                        break;
295
330
                default:
296
331
                        break;
297
332
                }
306
341
void headerbox(ScrArea *area)
307
342
{
308
343
        float width= area->winx;
 
344
        int active=0;
309
345
 
310
346
        glClearColor(SCR_BACK, SCR_BACK, SCR_BACK, 0.0);
311
347
        glClear(GL_COLOR_BUFFER_BIT);
312
348
 
313
 
        if(area_is_active_area(area)) BIF_ThemeColor(TH_HEADER);
 
349
        active= area_is_active_area(area);
 
350
 
 
351
        if(active) BIF_ThemeColor(TH_HEADER);
314
352
        else BIF_ThemeColor(TH_HEADERDESEL);
315
353
 
316
354
        /* weird values here... is because of window matrix that centres buttons */
317
355
        if(area->headertype==HEADERTOP) {
318
356
                uiSetRoundBox(3);
319
 
                uiRoundBoxEmboss(-0.5+area->headbutofs, -10.0, width-1.5+area->headbutofs, HEADERY-2.0, SCR_ROUND);
 
357
                uiRoundBoxEmboss(-0.5+area->headbutofs, -10.0, width-1.5+area->headbutofs, HEADERY-2.0, SCR_ROUND, active);
320
358
        }
321
359
        else {
322
360
                uiSetRoundBox(12);
323
 
                uiRoundBoxEmboss(-0.5+area->headbutofs, -3.5, width-1.5+area->headbutofs, HEADERY+10, SCR_ROUND);
 
361
                uiRoundBoxEmboss(-0.5+area->headbutofs, -3.5, width-1.5+area->headbutofs, HEADERY+10, SCR_ROUND, active);
324
362
        }
325
363
        
326
364
        uiSetRoundBox(15);
356
394
                case SPACE_SOUND:       sound_buttons();        break;
357
395
                case SPACE_ACTION:      action_buttons();       break;
358
396
                case SPACE_NLA:         nla_buttons();          break;
 
397
                case SPACE_TIME:        time_buttons(area);     break;
359
398
                }
360
399
 
361
400
                //glScissor(area->winrct.xmin, area->winrct.xmax, area->winx, area->winy);
367
406
        float ofs= area->headbutofs;
368
407
 
369
408
        if (area->headertype==HEADERDOWN) {
370
 
                bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -3.375, area->headrct.ymax-area->headrct.ymin-3.375);
 
409
                bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -3.375, area->headrct.ymax-area->headrct.ymin-3.375+1.0);
371
410
        } else if (area->headertype==HEADERTOP) {
372
 
                bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -2.375, area->headrct.ymax-area->headrct.ymin-2.375);
 
411
                bwin_ortho2(area->headwin, -0.375+ofs, area->headrct.xmax-area->headrct.xmin-0.375+ofs, -2.375-1.0, area->headrct.ymax-area->headrct.ymin-2.375);
373
412
        }
374
413
}
375
414
 
544
583
void markdirty_all()
545
584
{
546
585
        ScrArea *sa;
547
 
 
548
 
        for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
549
 
                scrarea_queue_winredraw(sa);
550
 
                sa->win_swap &= ~WIN_FRONT_OK;
551
 
                
552
 
                scrarea_queue_headredraw(sa);
553
 
                sa->head_swap &= ~WIN_FRONT_OK;
554
 
        }
555
 
}
 
586
        for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
 
587
                if(sa->win) {
 
588
                        scrarea_queue_winredraw(sa);
 
589
                        sa->win_swap &= ~WIN_FRONT_OK;
 
590
                }
 
591
                if(sa->headwin) {
 
592
                        scrarea_queue_headredraw(sa);
 
593
                        sa->head_swap &= ~WIN_FRONT_OK;
 
594
                }
 
595
        }
 
596
}
 
597
 
 
598
/* but no redraw! */
 
599
void markdirty_all_back(void)
 
600
{
 
601
        ScrArea *sa;
 
602
        
 
603
        for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
 
604
                if(sa->win) {
 
605
                        sa->win_swap &= ~WIN_BACK_OK;
 
606
                }
 
607
                if(sa->headwin) {
 
608
                        sa->head_swap &= ~WIN_BACK_OK;
 
609
                }
 
610
        }
 
611
        
 
612
        /* if needed; backbuffer selection redraw */
 
613
        if(G.vd) G.vd->flag |= V3D_NEEDBACKBUFDRAW;
 
614
 
 
615
}
 
616
 
 
617
void markdirty_win_back(short winid)
 
618
{
 
619
        ScrArea *sa= areawinar[winid];
 
620
        if(sa) {
 
621
                if(sa->win==winid) sa->win_swap &= ~WIN_BACK_OK;
 
622
                else sa->head_swap &= ~WIN_BACK_OK;
 
623
        }
 
624
}
 
625
 
556
626
 
557
627
int is_allowed_to_change_screen(bScreen *new)
558
628
{
571
641
 
572
642
void splash(void *data, int datasize, char *string)
573
643
{
 
644
        extern void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
574
645
        ImBuf *bbuf;
575
646
        int oldwin;
576
647
        short val;
597
668
                }
598
669
                glDrawBuffer(GL_FRONT);
599
670
                
600
 
                /*
601
 
                // this dims the whole screen a bit. I didn't like it afterall
602
 
                glEnable(GL_BLEND);
603
 
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
604
 
                glColor4f(0.0,0.0,0.0,0.3);
605
 
                glRecti(0, 0, G.curscreen->sizex, G.curscreen->sizey);
606
 
                glDisable(GL_BLEND);
607
 
                */
 
671
                uiDrawBoxShadow(200, (prefsizx-bbuf->x)/2, (prefsizy-bbuf->y)/2, (prefsizx+bbuf->x)/2, (prefsizy+bbuf->y)/2);
608
672
                
609
673
                glRasterPos2i((prefsizx-bbuf->x)/2, (prefsizy-bbuf->y)/2);      
610
674
                glDrawPixels(bbuf->x, bbuf->y, GL_RGBA, GL_UNSIGNED_BYTE, bbuf->rect);
624
688
                        BMF_DrawString(font, string);
625
689
                }
626
690
 
627
 
                glFinish();
 
691
                glFlush();
628
692
                glDrawBuffer(GL_BACK);
629
693
                
630
694
                IMB_freeImBuf(bbuf);
651
715
static void joinarea(ScrArea *sa, ScrEdge *onedge);
652
716
static void splitarea_interactive(ScrArea *area, ScrEdge *onedge);
653
717
 
654
 
static void screen_edge_edit_event(ScrArea *actarea, ScrEdge *actedge, short evt, short val) {
 
718
static void screen_edge_edit_event(ScrArea *actarea, ScrEdge *actedge, short evt, short val) 
 
719
{
655
720
        if (val) {
656
721
                        // don't allow users to edit full screens
657
722
                if (actarea && actarea->full) {
664
729
                        int edgeop;
665
730
                
666
731
                        if (!actarea->headertype) {
667
 
                                edgeop= pupmenu("Split Area|Join Areas|Add header");
 
732
                                edgeop= pupmenu("Split Area|Join Areas|Add Header");
668
733
                        } else {
669
 
                                edgeop= pupmenu("Split Area|Join Areas|No header");
 
734
                                edgeop= pupmenu("Split Area|Join Areas|No Header");
670
735
                        }
671
736
 
672
737
                        if (edgeop==1) {
677
742
                                scrarea_change_headertype(actarea, actarea->headertype?0:HEADERDOWN);
678
743
                        }
679
744
                }
 
745
                else blenderqread(evt, val);    // global hotkeys
680
746
        }
681
747
}
682
748
 
683
749
/***/
684
750
 
685
 
void mywindow_init_mainwin(Window *win, int orx, int ory, int sizex, int sizey);
 
751
extern void mywindow_init_mainwin(Window *win, int orx, int ory, int sizex, int sizey);
686
752
void test_scale_screen(bScreen *);
687
753
 
688
754
static void resize_screens(int x, int y, int w, int h) {
741
807
        }
742
808
}
743
809
 
 
810
/* check for event in afterqueue, used in force_draw in space.c */
 
811
int afterqtest(short win, unsigned short evt)
 
812
{
 
813
        int a;
 
814
        
 
815
        for(a=0; a<nafterqitems; a++) {
 
816
                if(afterqueue[a][0]==win && afterqueue[a][1]==evt) return 1;
 
817
        }
 
818
        return 0;
 
819
}
 
820
 
 
821
 
744
822
static char ext_load_str[256]= {0, 0};
745
823
void add_readfile_event(char *filename)
746
824
{       
821
899
                if(*val) G.qual |= LR_CTRLKEY;
822
900
                else G.qual &= ~LR_CTRLKEY;
823
901
        }
 
902
        else if(event==COMMANDKEY) {            // OSX
 
903
                if(*val) G.qual |= LR_COMMANDKEY;
 
904
                else G.qual &= ~LR_COMMANDKEY;
 
905
        }
824
906
 
825
907
        return event;
826
908
}
836
918
        else if(event==INPUTCHANGE) ext_inputchange= *val;
837
919
        else if(event==MOUSEY || event==MOUSEX) ext_mousemove= 1;
838
920
        else if((G.qual & (LR_CTRLKEY|LR_ALTKEY)) && event==F3KEY) {
839
 
                if(*val) BIF_screendump();
 
921
                if(*val) BIF_screendump(0);
840
922
        }
841
923
 
842
924
        return event;
875
957
        window_set_timer(mainwin, U.savetime*60*1000, AUTOSAVE_FILE);
876
958
}
877
959
 
 
960
/* ************ handlers ************** */
 
961
 
 
962
/* don't know yet how the handlers will evolve, for simplicity
 
963
i choose for an array with eventcodes, this saves in a file!
 
964
*/
 
965
void add_screenhandler(bScreen *sc, short eventcode, short val)
 
966
{
 
967
        short a;
 
968
        
 
969
        // find empty spot
 
970
        for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
 
971
                if( sc->handler[a]==eventcode ) {
 
972
                        sc->handler[a+1]= val;
 
973
                        break;
 
974
                }
 
975
                else if( sc->handler[a]==0) {
 
976
                        sc->handler[a]= eventcode;
 
977
                        sc->handler[a+1]= val;
 
978
                        break;
 
979
                }
 
980
        }
 
981
        if(a==SCREEN_MAXHANDLER) printf("error; max (4) screen handlers reached!\n");
 
982
}
 
983
 
 
984
void rem_screenhandler(bScreen *sc, short eventcode)
 
985
{
 
986
        short a;
 
987
        
 
988
        for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
 
989
                if( sc->handler[a]==eventcode) {
 
990
                        sc->handler[a]= 0;
 
991
                        break;
 
992
                }
 
993
        }
 
994
}
 
995
 
 
996
int has_screenhandler(bScreen *sc, short eventcode)
 
997
{
 
998
        short a;
 
999
        
 
1000
        for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
 
1001
                if( sc->handler[a]==eventcode) {
 
1002
                        return 1;
 
1003
                }
 
1004
        }
 
1005
        return 0;
 
1006
}
 
1007
 
 
1008
static void animated_screen(bScreen *sc, short val)
 
1009
{
 
1010
        if (U.mixbufsize && (val & TIME_WITH_SEQ_AUDIO)) {
 
1011
                if(CFRA>=EFRA) {
 
1012
                        CFRA= SFRA;
 
1013
                        audiostream_stop();
 
1014
                        audiostream_start( CFRA );
 
1015
                }
 
1016
                else {
 
1017
                        int cfra = audiostream_pos();
 
1018
                        if(cfra <= CFRA) CFRA++;
 
1019
                        else CFRA= cfra;
 
1020
                }
 
1021
        }
 
1022
        else {
 
1023
                CFRA++;
 
1024
                if(CFRA > EFRA) CFRA= SFRA;
 
1025
        }
 
1026
        
 
1027
        update_for_newframe_nodraw(1);
 
1028
        
 
1029
        if(val & TIME_ALL_3D_WIN)
 
1030
                allqueue(REDRAWVIEW3D, 0);
 
1031
        else if(val & TIME_LEFTMOST_3D_WIN) {
 
1032
                ScrArea *sa= sc->areabase.first, *samin=NULL;
 
1033
                int min= 10000;
 
1034
                for(; sa; sa= sa->next) {
 
1035
                        if(sa->spacetype==SPACE_VIEW3D) {
 
1036
                                if(sa->winrct.xmin - sa->winrct.ymin < min) {
 
1037
                                        samin= sa;
 
1038
                                        min= sa->winrct.xmin - sa->winrct.ymin;
 
1039
                                }
 
1040
                        }
 
1041
                }
 
1042
                if(samin) scrarea_queue_winredraw(samin);
 
1043
        }
 
1044
        if(val & TIME_ALL_ANIM_WIN) allqueue(REDRAWANIM, 0);
 
1045
        if(val & TIME_ALL_BUTS_WIN) allqueue(REDRAWBUTSALL, 0);
 
1046
        
 
1047
        allqueue(REDRAWTIME, 0);
 
1048
}
 
1049
 
 
1050
/* because we still have to cope with subloops, this function is called
 
1051
in viewmove() for example too */
 
1052
 
 
1053
/* returns 1 if something was handled */
 
1054
/* restricts to frames-per-second setting for frequency of updates */
 
1055
int do_screenhandlers(bScreen *sc)
 
1056
{
 
1057
        static double ltime=0.0;
 
1058
        double swaptime, time;
 
1059
        short a, done= 0;
 
1060
        
 
1061
        time = PIL_check_seconds_timer();
 
1062
        swaptime= 1.0/(float)G.scene->r.frs_sec;
 
1063
        
 
1064
        /* only now do the handlers */
 
1065
        if(swaptime < time-ltime || ltime==0.0) {
 
1066
                
 
1067
                ltime= time;
 
1068
 
 
1069
                for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
 
1070
                        switch(sc->handler[a]) {
 
1071
                                case SCREEN_HANDLER_ANIM:
 
1072
                                        animated_screen(sc, sc->handler[a+1]);
 
1073
                                        done= 1;
 
1074
                                        break;
 
1075
                                case SCREEN_HANDLER_PYTHON:
 
1076
                                        done= 1;
 
1077
                                        break;
 
1078
                                case SCREEN_HANDLER_VERSE:
 
1079
                                        done= 1;
 
1080
                                        break;
 
1081
                        }
 
1082
                }
 
1083
        }
 
1084
        else if( qtest()==0) PIL_sleep_ms(5);   // 5 milliseconds pause, for idle
 
1085
 
 
1086
        /* separate check for if we need to add to afterqueue */
 
1087
        /* is only to keep mainqueue awqke */
 
1088
        for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
 
1089
                if(sc->handler[a]) {
 
1090
                        ScrArea *sa= sc->areabase.first;
 
1091
                        if(sa->headwin) addafterqueue(sa->headwin, SCREEN_HANDLER, 1);
 
1092
                        else addafterqueue(sa->win, SCREEN_HANDLER, 1);
 
1093
                }
 
1094
        }
 
1095
        
 
1096
        return done;
 
1097
}
 
1098
 
 
1099
/* ****** end screen handlers ************ */
 
1100
 
878
1101
static void screen_dispatch_events(void) {
879
1102
        int events_remaining= 1;
880
1103
        ScrArea *sa;
909
1132
        }
910
1133
        
911
1134
        screen_swapbuffers();
 
1135
        do_screenhandlers(G.curscreen);
912
1136
}
913
1137
 
914
1138
static ScrArea *screen_find_area_for_pt(bScreen *sc, short *mval) 
927
1151
        return NULL;
928
1152
}
929
1153
 
 
1154
/* ugly yah, will disappear on better event system */
 
1155
/* is called from interface.c after button events */
 
1156
static char delayed_undo_name[64];
 
1157
void screen_delayed_undo_push(char *name)
 
1158
{
 
1159
        strncpy(delayed_undo_name, name, 63);
 
1160
        mainqenter(UNDOPUSH, 1);
 
1161
}
 
1162
 
930
1163
void screenmain(void)
931
1164
{
932
1165
        int has_input= 1;
933
1166
        int firsttime = 1;
934
 
        
 
1167
        int onload_script = 0;
 
1168
 
935
1169
        window_make_active(mainwin);
936
1170
        
937
1171
        while (1) {
951
1185
 
952
1186
                if (event==INPUTCHANGE) {
953
1187
                        window_make_active(mainwin);
954
 
                        has_input= val;
 
1188
                        G.qual= get_qual();
955
1189
                }
956
1190
                
957
1191
                        /* If the main window is active, find the current active ScrArea
1020
1254
                        markdirty_all();
1021
1255
                        dodrawscreen= 1;
1022
1256
                }
 
1257
                else if( event==UNDOPUSH) {
 
1258
                        BIF_undo_push(delayed_undo_name);
 
1259
                }
1023
1260
                else if (event==AUTOSAVE_FILE) {
1024
1261
                        BIF_write_autosave();
1025
1262
                }
1027
1264
                        BIF_read_file(ext_load_str);
1028
1265
                        sound_initialize_sounds();
1029
1266
                }
 
1267
                else if ((event==ONLOAD_SCRIPT) && BPY_has_onload_script()) {
 
1268
                        /* event queued in setup_app_data() in blender.c, where G.f is checked */
 
1269
                        onload_script = 1;
 
1270
                        firsttime = 1; /* see last 'if' in this function */
 
1271
                }
1030
1272
                else {
1031
1273
                        towin= 1;
1032
1274
                }
1034
1276
                if (!g_activearea) {
1035
1277
                        towin= 0;
1036
1278
                }
 
1279
                else if (event==QKEY) {
 
1280
                        if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);
 
1281
                        else {
 
1282
                                if(val) {
 
1283
                                        if(okee("Quit Blender")) exit_usiblender();
 
1284
                                }
 
1285
                                towin= 0;
 
1286
                        }
 
1287
                }
 
1288
                else if(ELEM(event, LEFTARROWKEY, RIGHTARROWKEY)) {
 
1289
                        if(val && (G.qual & LR_CTRLKEY)) {
 
1290
                                bScreen *sc= (event==LEFTARROWKEY)?G.curscreen->id.prev:G.curscreen->id.next;
 
1291
                                if(is_allowed_to_change_screen(sc)) setscreen(sc);
 
1292
                                g_activearea= NULL;
 
1293
                                towin= 0;
 
1294
                        }
 
1295
                }
1037
1296
                else if (!G.curscreen->winakt) {
1038
1297
                        ScrEdge *actedge;
1039
1298
                        short mval[2];
1047
1306
                                } else {
1048
1307
                                        set_cursor(CURSOR_X_MOVE);
1049
1308
                                }
1050
 
 
 
1309
                                // this does global hotkeys too
1051
1310
                                screen_edge_edit_event(g_activearea, actedge, event, val);
1052
1311
                        } else {
1053
1312
                                set_cursor(CURSOR_STD);
1055
1314
                        
1056
1315
                        towin= 0;
1057
1316
                }
1058
 
                else if (event==QKEY) {
1059
 
                        if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);
1060
 
                        else {
1061
 
                                if(val && okee("QUIT BLENDER")) exit_usiblender();
1062
 
                                towin= 0;
1063
 
                        }
1064
 
                }
1065
1317
                else if (event==ZKEY) {
1066
1318
                        if(val && G.qual==(LR_ALTKEY|LR_SHIFTKEY|LR_CTRLKEY)) {
1067
1319
                                extern void set_debug_swapbuffers_ovveride(bScreen *sc, int mode);
1086
1338
                }
1087
1339
                else if (event==SPACEKEY) {
1088
1340
                        if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);
1089
 
                        else {
 
1341
                        else if(G.qual==0) {
1090
1342
                                if(val) toolbox_n();
1091
1343
                                towin= 0;
1092
1344
                        }
1093
1345
                }
1094
 
                else if(ELEM(event, LEFTARROWKEY, RIGHTARROWKEY)) {
1095
 
                        if(val && (G.qual & LR_CTRLKEY)) {
1096
 
                                bScreen *sc= (event==LEFTARROWKEY)?G.curscreen->id.prev:G.curscreen->id.next;
1097
 
                                if(is_allowed_to_change_screen(sc)) setscreen(sc);
1098
 
                                g_activearea= NULL;
1099
 
                                towin= 0;
1100
 
                        }
1101
 
                }
1102
1346
                else if(ELEM(event, UPARROWKEY, DOWNARROWKEY)) {
1103
1347
                        if(val && (G.qual & LR_CTRLKEY)) {
1104
1348
                                area_fullscreen();
1108
1352
                }
1109
1353
 
1110
1354
                if (towin && event) {
1111
 
                        if (blenderqread(event, val))
 
1355
                        if (blenderqread(event, val))   // the global keys
1112
1356
                                addqueue_ext(G.curscreen->winakt, event, val, ascii);
1113
1357
                }
1114
1358
 
1119
1363
                if (event==0 || event==EXECUTE) {
1120
1364
                        screen_dispatch_events();
1121
1365
                }
1122
 
 
 
1366
                
 
1367
                if(G.f & G_DEBUG) {
 
1368
                        GLenum error = glGetError();
 
1369
                        if (error)
 
1370
                                printf("GL error: %s\n", gluErrorString(error));
 
1371
                }
1123
1372
                /* Bizar hack. The event queue has mutated... */
1124
1373
                if ( (firsttime) && (event == 0) ) {
1125
 
                        
1126
 
                        if (G.fileflags & G_FILE_AUTOPLAY) {
 
1374
 
 
1375
                        if (onload_script) {
 
1376
                                /* OnLoad scriptlink */
 
1377
                                BPY_do_pyscript(&G.scene->id, SCRIPT_ONLOAD);
 
1378
                                onload_script = 0;
 
1379
                        }
 
1380
                        else if (G.fileflags & G_FILE_AUTOPLAY) {
1127
1381
                                // SET AUTOPLAY in G.flags for
1128
1382
                                // other fileloads
1129
1383
 
1149
1403
        }
1150
1404
}
1151
1405
 
1152
 
#ifdef _WIN32   // FULLSCREEN
 
1406
#if 0
 
1407
//#ifdef _WIN32 // FULLSCREEN
1153
1408
void mainwindow_toggle_fullscreen(int fullscreen){
1154
1409
        if (fullscreen) U.uiflag |= USER_FLIPFULLSCREEN;
1155
1410
        else U.uiflag &= ~USER_FLIPFULLSCREEN;
1193
1448
        int scrwidth, scrheight;
1194
1449
        
1195
1450
        winlay_get_screensize(&scrwidth, &scrheight);
1196
 
        
 
1451
                
1197
1452
        if(stax<0) stax= 0;
1198
1453
        if(stay<0) stay= 0;
1199
1454
        if(sizx<320) sizx= 320;
1200
1455
        if(sizy<256) sizy= 256;
1201
1456
 
1202
 
        if(stax+sizx>scrwidth) sizx= scrwidth-stax;
1203
 
 
1204
 
        if(stay+sizy>scrheight) sizy= scrheight-stay;
1205
 
 
1206
 
#ifdef __APPLE__
1207
 
        if(stay+sizy>scrheight-22) sizy= scrheight-22-stay;     // 22 = topbar
1208
 
#endif
 
1457
        if(stax+sizx>scrwidth) {
 
1458
                fprintf(stderr," width prob \n");
 
1459
                sizx= scrwidth-stax;
 
1460
                }
 
1461
 
 
1462
        if(stay+sizy>scrheight) {
 
1463
                fprintf(stderr," height prob \n");
 
1464
                sizy= scrheight-stay;
 
1465
                }
 
1466
 
 
1467
/* #ifdef __APPLE__ */
 
1468
/*      if(stay+sizy>scrheight-22) sizy= scrheight-22-stay;     // 22 = topbar  */
 
1469
/* #endif*/
1209
1470
 
1210
1471
        if(sizx<320 || sizy<256) {
1211
1472
                printf("ERROR: illegal prefsize\n");
1489
1750
static void copy_areadata(ScrArea *sa1, ScrArea *sa2)
1490
1751
{
1491
1752
        Panel *pa1, *pa2, *patab;
1492
 
        
 
1753
        ScriptLink *slink1 = &sa1->scriptlink, *slink2 = &sa2->scriptlink;
 
1754
 
1493
1755
        sa1->headertype= sa2->headertype;
1494
1756
        sa1->spacetype= sa2->spacetype;
1495
1757
        Mat4CpyMat4(sa1->winmat, sa2->winmat);
1496
 
        
 
1758
 
1497
1759
        freespacelist(&sa1->spacedata);
1498
1760
        duplicatespacelist(sa1, &sa1->spacedata, &sa2->spacedata);
1499
1761
 
1500
1762
        BLI_freelistN(&sa1->panels);
1501
1763
        duplicatelist(&sa1->panels, &sa2->panels);
1502
 
        
 
1764
 
 
1765
        /* space handler script links */
 
1766
        if (slink1->totscript) {
 
1767
                MEM_freeN(slink1->scripts);
 
1768
                MEM_freeN(slink1->flag);
 
1769
                slink1->totscript = 0;
 
1770
        }
 
1771
        if (slink2->totscript) {
 
1772
                slink1->scripts = MEM_dupallocN(slink2->scripts);
 
1773
                slink1->flag = MEM_dupallocN(slink2->flag);
 
1774
                slink1->totscript = slink2->totscript;
 
1775
        }
 
1776
 
1503
1777
        /* copy pointers */
1504
1778
        pa1= sa1->panels.first;
1505
1779
        while(pa1) {
1545
1819
 
1546
1820
static void testareas(void)
1547
1821
{
1548
 
        ScrArea *sa;
 
1822
        ScrArea *sa, *next;
1549
1823
 
1550
1824
        /* test for header, if removed, or moved */
1551
 
        /* testen for window, if removed, or moved */
1552
 
 
1553
 
        for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
 
1825
        /* test for window, if removed, or moved */
 
1826
        
 
1827
        sa= G.curscreen->areabase.first;
 
1828
        while(sa) {
1554
1829
                rcti oldhr= sa->headrct;
1555
1830
                rcti oldwr= sa->winrct;
1556
1831
                
 
1832
                next= sa->next;
 
1833
                
1557
1834
                calc_arearcts(sa);
1558
 
 
1559
 
                        /* test header */
1560
 
                if (sa->headwin) {
1561
 
                        if (!rcti_eq(&oldhr, &sa->headrct)) {
1562
 
                                mywinposition(sa->headwin, sa->headrct.xmin, sa->headrct.xmax, sa->headrct.ymin, sa->headrct.ymax);
1563
 
                                addqueue(sa->headwin, CHANGED, 1);
1564
 
                        }
1565
 
                                
1566
 
                        if(sa->headbutlen<sa->winx) {
1567
 
                                sa->headbutofs= 0;
1568
 
                                addqueue(sa->headwin, CHANGED, 1);
1569
 
                        }
1570
 
                        else if(sa->headbutofs+sa->winx > sa->headbutlen) {
1571
 
                                sa->headbutofs= sa->headbutlen-sa->winx;
1572
 
                                addqueue(sa->headwin, CHANGED, 1);
1573
 
                        }
1574
 
                }
1575
 
 
1576
 
                if (!rcti_eq(&oldwr, &sa->winrct)) {
1577
 
                        mywinposition(sa->win, sa->winrct.xmin, sa->winrct.xmax, sa->winrct.ymin, sa->winrct.ymax);
1578
 
                        addqueue(sa->win, CHANGED, 1);
1579
 
                }
 
1835
                
 
1836
                /* ilegally scaled down area.... */
 
1837
                if(sa->totrct.xmin>=sa->totrct.xmax || sa->totrct.ymin>=sa->totrct.ymax) {
 
1838
                        del_area(sa);
 
1839
                        BLI_remlink(&G.curscreen->areabase, sa);
 
1840
                        MEM_freeN(sa);
 
1841
                        printf("Warning, removed zero sized window from screen %s\n", G.curscreen->id.name+2);
 
1842
                }
 
1843
                else {
 
1844
                                /* test header */
 
1845
                        if (sa->headwin) {
 
1846
                                if (!rcti_eq(&oldhr, &sa->headrct)) {
 
1847
                                        mywinposition(sa->headwin, sa->headrct.xmin, sa->headrct.xmax, sa->headrct.ymin, sa->headrct.ymax);
 
1848
                                        addqueue(sa->headwin, CHANGED, 1);
 
1849
                                }
 
1850
                                        
 
1851
                                if(sa->headbutlen<sa->winx) {
 
1852
                                        sa->headbutofs= 0;
 
1853
                                        addqueue(sa->headwin, CHANGED, 1);
 
1854
                                }
 
1855
                                else if(sa->headbutofs+sa->winx > sa->headbutlen) {
 
1856
                                        sa->headbutofs= sa->headbutlen-sa->winx;
 
1857
                                        addqueue(sa->headwin, CHANGED, 1);
 
1858
                                }
 
1859
                        }
 
1860
 
 
1861
                        if (!rcti_eq(&oldwr, &sa->winrct)) {
 
1862
                                mywinposition(sa->win, sa->winrct.xmin, sa->winrct.xmax, sa->winrct.ymin, sa->winrct.ymax);
 
1863
                                addqueue(sa->win, CHANGED, 1);
 
1864
                        }
 
1865
                }
 
1866
                sa= next;
1580
1867
        }
1581
1868
        
1582
1869
                /* remake global windowarray */
1706
1993
        return window_get_mbut(mainwin);
1707
1994
}
1708
1995
 
1709
 
static unsigned short convert_for_nonumpad(unsigned short event)
1710
 
{
1711
 
        if (event>=ZEROKEY && event<=NINEKEY) {
1712
 
                return event - ZEROKEY + PAD0;
1713
 
        } else if (event==MINUSKEY) {
1714
 
                return PADMINUS;
1715
 
        } else if (event==EQUALKEY) {
1716
 
                return PADPLUSKEY;
1717
 
        } else if (event==BACKSLASHKEY) {
1718
 
                return PADSLASHKEY;
1719
 
        } else {
1720
 
                return event;
1721
 
        }
1722
 
}
1723
 
 
1724
1996
void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char ascii)
1725
1997
{
1726
1998
 
1727
1999
        statechanged= 1;
1728
2000
 
1729
 
        if (U.flag & USER_NONUMPAD) {
1730
 
                evt= convert_for_nonumpad(evt);
1731
 
        }
1732
 
 
1733
2001
        /*  accept the extended ascii set (ton) */
1734
2002
        if( !val || ascii<32 ) {
1735
2003
                ascii= '\0';
1778
2046
        sc->scene= G.scene;
1779
2047
        
1780
2048
        if (!mainwin) {
1781
 
#ifdef _WIN32   // FULLSCREEN
 
2049
#if 0
 
2050
//#ifdef _WIN32 // FULLSCREEN
1782
2051
                if (G.windowstate == G_WINDOWSTATE_FULLSCREEN)
1783
2052
                        mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, G_WINDOWSTATE_FULLSCREEN);
1784
2053
                else
1796
2065
                init_mainwin();
1797
2066
                mywinset(1);
1798
2067
        
1799
 
                glMatrixMode(GL_PROJECTION);
1800
 
                glLoadIdentity();
1801
 
                myortho2(-0.375, sc->sizex-0.375, -0.375, sc->sizey-0.375);
1802
 
                glMatrixMode(GL_MODELVIEW);
1803
 
                glLoadIdentity();
1804
 
 
1805
2068
                /* for visual speed, but still needed? */
1806
2069
                glClearColor(.55, .55, .55, 0.0);
1807
2070
                glClear(GL_COLOR_BUFFER_BIT);
1864
2127
                        sa= sa->next;
1865
2128
                }               
1866
2129
        }
 
2130
        else if(G.curscreen) markdirty_all();   /* at least redraw */
1867
2131
 
1868
2132
        if (G.curscreen != sc) {
1869
2133
                mywinset(sc->mainwin);
1898
2162
 
1899
2163
                                /* patch for old files */
1900
2164
                                if(soops->v2d.cur.xmin==soops->v2d.cur.xmax) {
1901
 
                                        extern void init_v2d_oops(View2D*);
1902
 
                                        init_v2d_oops(&soops->v2d);
 
2165
                                        init_v2d_oops(sa, soops);
1903
2166
                                }
1904
2167
                        }
1905
2168
                        else if(sl->spacetype==SPACE_BUTS) {
1910
2173
                
1911
2174
                sa->cursor= CURSOR_STD;
1912
2175
        }
1913
 
 
 
2176
        
1914
2177
        G.scene= sc->scene;
1915
2178
        countall();
1916
2179
        
2330
2593
 
2331
2594
        if (split) {
2332
2595
                if(dir=='h') {
2333
 
                        glutil_draw_front_xor_line(sa->totrct.xmin, split, sa->totrct.xmax, split);
2334
 
                        glutil_draw_front_xor_line(sa->totrct.xmin, split-1, sa->totrct.xmax, split-1);
 
2596
                        sdrawXORline(sa->totrct.xmin, split, sa->totrct.xmax, split);
 
2597
                        sdrawXORline(sa->totrct.xmin, split-1, sa->totrct.xmax, split-1);
2335
2598
                } else {
2336
 
                        glutil_draw_front_xor_line(split, sa->totrct.ymin, split, sa->totrct.ymax);
2337
 
                        glutil_draw_front_xor_line(split-1, sa->totrct.ymin, split-1, sa->totrct.ymax);
 
2599
                        sdrawXORline(split, sa->totrct.ymin, split, sa->totrct.ymax);
 
2600
                        sdrawXORline(split-1, sa->totrct.ymin, split-1, sa->totrct.ymax);
2338
2601
                }
2339
2602
        }
2340
2603
}
2342
2605
static void splitarea_interactive(ScrArea *area, ScrEdge *onedge)
2343
2606
{
2344
2607
        ScrArea *sa= area;
 
2608
        ScrArea *scr;
2345
2609
        float fac= 0.0;
2346
2610
        unsigned short event;
2347
2611
        short ok= 0, val, split = 0, mval[2], mvalo[2], first= 1;
2354
2618
        
2355
2619
        mywinset(G.curscreen->mainwin);
2356
2620
        /* should already have a good matrix */
 
2621
        glReadBuffer(GL_FRONT);
 
2622
        glDrawBuffer(GL_FRONT);
2357
2623
 
2358
2624
        /* keep track of grid and minsize */
2359
2625
        while(ok==0) {
2360
2626
                getmouseco_sc(mval);
 
2627
 
 
2628
                /* this part of code allows to choose, what window will be splited */
 
2629
                /* cursor is out of the current ScreenArea */
 
2630
                if((mval[0] < sa->v1->vec.x) || (mval[0] > sa->v3->vec.x) ||
 
2631
                (mval[1] < sa->v1->vec.y) || (mval[1] > sa->v3->vec.y)){
 
2632
                        scr= (ScrArea*)G.curscreen->areabase.first;
 
2633
                        while(scr){
 
2634
                                if((mval[0] > scr->v1->vec.x) && (mval[0] < scr->v4->vec.x) &&
 
2635
                                (mval[1] < scr->v2->vec.y) && (mval[1] > scr->v1->vec.y)){
 
2636
                                        /* test: is ScreenArea enough big for splitting */
 
2637
                                        split= testsplitpoint(scr, dir, fac);
 
2638
                                        if(split){
 
2639
                                                /* delete old line from previous ScreenArea */
 
2640
                                                if(!first) scrarea_draw_splitpoint(sa, dir, fac);
 
2641
                                                sa= scr;
 
2642
                                                first= 1;
 
2643
                                                break;
 
2644
                                        }
 
2645
                                }
 
2646
                                scr= scr->next;
 
2647
                        }
 
2648
                }
2361
2649
                
2362
2650
                if (first || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
2363
2651
                        if (!first) {
2385
2673
                }
2386
2674
                
2387
2675
                event= extern_qread(&val);
 
2676
 
 
2677
                /* change direction of splitting between horizontal and vertical
 
2678
                 * patch was offered by Guillaume */
 
2679
                if(val && (event==TABKEY || event==MIDDLEMOUSE)) {
 
2680
                        scrarea_draw_splitpoint(sa, dir, fac);
 
2681
                        if(dir=='h') {
 
2682
                                dir='v';
 
2683
                                set_cursor(CURSOR_Y_MOVE);
 
2684
                        } else {
 
2685
                                dir='h';
 
2686
                                set_cursor(CURSOR_X_MOVE);
 
2687
                        }
 
2688
                        first= 1;
 
2689
                }
 
2690
 
2388
2691
                if(val && event==LEFTMOUSE) {
2389
2692
                        if(dir=='h') {
2390
2693
                                fac= split- (sa->v1->vec.y);
2396
2699
                        }
2397
2700
                        ok= 1;
2398
2701
                }
2399
 
                if(val && event==ESCKEY) {
 
2702
                if(val && (event==ESCKEY || event==RIGHTMOUSE)) {
2400
2703
                        ok= -1;
2401
2704
                }
 
2705
                glFlush();
2402
2706
        }
2403
2707
 
2404
2708
        if (!first) {
2405
2709
                scrarea_draw_splitpoint(sa, dir, fac);
 
2710
                glFlush();
2406
2711
        }
 
2712
        glReadBuffer(GL_BACK);
 
2713
        glDrawBuffer(GL_BACK);
2407
2714
 
2408
2715
        if(ok==1) {
2409
2716
                splitarea(sa, dir, fac);
2574
2881
        }
2575
2882
 
2576
2883
        /* make each window at least HEADERY high */
2577
 
 
2578
2884
        sa= sc->areabase.first;
2579
2885
        while(sa) {
2580
2886
 
2605
2911
static void draw_front_xor_dirdist_line(char dir, int dist, int start, int end)
2606
2912
{
2607
2913
        if (dir=='h') {
2608
 
                glutil_draw_front_xor_line(start, dist, end, dist);
2609
 
                glutil_draw_front_xor_line(start, dist+1, end, dist+1);
 
2914
                sdrawXORline(start, dist, end, dist);
 
2915
                sdrawXORline(start, dist+1, end, dist+1);
2610
2916
        } else {
2611
 
                glutil_draw_front_xor_line(dist, start, dist, end);
2612
 
                glutil_draw_front_xor_line(dist+1, start, dist+1, end);
 
2917
                sdrawXORline(dist, start, dist, end);
 
2918
                sdrawXORline(dist+1, start, dist+1, end);
2613
2919
        }
2614
2920
}
2615
2921
 
2691
2997
        
2692
2998
        mywinset(G.curscreen->mainwin);
2693
2999
 
 
3000
        glReadBuffer(GL_FRONT);
 
3001
        glDrawBuffer(GL_FRONT);
 
3002
 
2694
3003
        doit= delta= 0;
2695
3004
        getmouseco_sc(mvalo);
2696
3005
        draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
2710
3019
                        delta= CLAMPIS(delta, -smaller, bigger);
2711
3020
                        
2712
3021
                        draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
2713
 
 
 
3022
                        glFlush();
2714
3023
                } 
2715
3024
                else if (event==LEFTMOUSE) {
2716
3025
                        doit= 1;
2721
3030
                        else if (ELEM(event, SPACEKEY, RETKEY))
2722
3031
                                doit= 1;
2723
3032
                }
 
3033
                else BIF_wait_for_statechange();
 
3034
                
2724
3035
        }
2725
3036
        draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
 
3037
        glFlush();
 
3038
        glReadBuffer(GL_BACK);
 
3039
        glDrawBuffer(GL_BACK);
2726
3040
 
2727
3041
        if (doit==1) {
2728
3042
                for (v1= G.curscreen->vertbase.first; v1; v1= v1->next) {
2735
3049
                                if((dir=='h') && v1->vec.y>0 && v1->vec.y<G.curscreen->sizey-1) {
2736
3050
                                        v1->vec.y+= delta;
2737
3051
                                        
2738
 
                                        /* with these lines commented out you can pull the top bar exact to the screen border. */
2739
 
                                        /* if(delta != bigger && delta != -smaller) { */
2740
 
                                                v1->vec.y+= AREAGRID-1;
2741
 
                                                v1->vec.y-= (v1->vec.y % AREAGRID);
 
3052
                                        v1->vec.y+= AREAGRID-1;
 
3053
                                        v1->vec.y-= (v1->vec.y % AREAGRID);
2742
3054
                                        
2743
 
                                        /* } */
 
3055
                                        /* prevent too small top header */
 
3056
                                        if(v1->vec.y > G.curscreen->sizey-HEADERY)
 
3057
                                                v1->vec.y= G.curscreen->sizey-HEADERY;
2744
3058
                                }
2745
3059
                        }
2746
3060
                        v1->flag= 0;
2751
3065
                testareas();
2752
3066
        }
2753
3067
        
2754
 
        glDrawBuffer(GL_BACK);
2755
3068
        mainqenter(DRAWEDGES, 1);
2756
3069
        dodrawscreen= 1;                /* patch! event gets lost,,,? */
2757
3070
}
2842
3155
                                G.curscreen->winakt= sa->win;
2843
3156
                                areawinset(G.curscreen->winakt);
2844
3157
                        } else {
2845
 
                                error("wrong window");
 
3158
                                error("Wrong window");
2846
3159
                                return 0;
2847
3160
                        }
2848
3161
                }
2889
3202
        if(FALSE && sa->spacetype==SPACE_VIEW3D) {
2890
3203
        cpack(0xA0A0A0);
2891
3204
        uiSetRoundBox(31);
2892
 
        uiRoundBoxEmboss(5.0, 5.0, 25.0, 100.0, 8.0);
 
3205
        uiRoundBoxEmboss(5.0, 5.0, 25.0, 100.0, 8.0, 0);
2893
3206
 
2894
3207
        glEnable(GL_BLEND);
2895
3208
        glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA); 
2924
3237
        cpack(0x0);
2925
3238
        
2926
3239
        /* right border area */
2927
 
        if(sa->headertype==HEADERTOP) sdrawline(x2, y1, x2, y2-SCR_ROUND);
2928
 
        else if(sa->headertype==HEADERDOWN) sdrawline(x2, y1+SCR_ROUND, x2, y2);
 
3240
        if(sa->headertype==HEADERTOP) sdrawline(x2, y1, x2, y2-SCR_ROUND+1);
 
3241
        else if(sa->headertype==HEADERDOWN) sdrawline(x2, y1+SCR_ROUND-1, x2, y2);
2929
3242
        else sdrawline(x2, y1, x2, y2);
2930
3243
        
2931
3244
        /* left border area */
2932
 
        if(sa->headertype==HEADERTOP) sdrawline(x1, y1, x1, y2-SCR_ROUND);
2933
 
        else if(sa->headertype==HEADERDOWN) sdrawline(x1, y1+SCR_ROUND, x1, y2);
2934
 
        else sdrawline(x1, y1, x1, y2);
2935
 
        
 
3245
        if(x1>0) { // otherwise it draws the emboss of window over
 
3246
                if(sa->headertype==HEADERTOP) sdrawline(x1, y1, x1, y2-SCR_ROUND+1);
 
3247
                else if(sa->headertype==HEADERDOWN) sdrawline(x1, y1+SCR_ROUND-1, x1, y2);
 
3248
                else sdrawline(x1, y1, x1, y2);
 
3249
        }       
2936
3250
        /* top border area */
2937
 
        if(sa->headertype==HEADERTOP) sdrawline(x1+SCR_ROUND, y2, x2-SCR_ROUND, y2);
 
3251
        if(sa->headertype==HEADERTOP) sdrawline(x1+SCR_ROUND-3, y2, x2-SCR_ROUND+3, y2);
2938
3252
        else sdrawline(x1, y2, x2, y2);
2939
3253
        
2940
3254
        /* bottom border area */
2941
 
        if(sa->headertype==HEADERDOWN) sdrawline(x1+SCR_ROUND, y1, x2-SCR_ROUND, y1);
 
3255
        if(sa->headertype==HEADERDOWN) sdrawline(x1+SCR_ROUND-3, y1, x2-SCR_ROUND+3, y1);
2942
3256
        else sdrawline(x1, y1, x2, y1);
2943
3257
        
2944
3258
}
3019
3333
                        glRasterPos2i(x,  y);
3020
3334
                        BMF_DrawString(G.fonts, text);
3021
3335
                        
3022
 
                        glFinish();
 
3336
                        glFlush();
3023
3337
                        glDrawBuffer(GL_BACK);
3024
3338
                        
3025
3339
                        sa->head_swap= WIN_FRONT_OK;