~hitmuri/vjpirate/trunk

« back to all changes in this revision

Viewing changes to src/ui/RenderWindow.cpp

  • Committer: Florent Berthaut
  • Date: 2014-07-26 18:53:16 UTC
  • mfrom: (5.1.12 mac)
  • Revision ID: flo@localhost.localdomain-20140726185316-c2ucnwmgm5kij4e2
Merged mac branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "RenderWindow.hpp"
25
25
#include "../base/Vjpirate.hpp"
26
26
#include <iostream>
27
 
#include <X11/Xlib.h>
28
 
#include <X11/Xatom.h>
29
27
#include <FL/x.H>
30
28
#include <math.h>
31
29
 
39
37
        end();
40
38
        m_width=this->w();
41
39
        m_height=this->h();
 
40
    resizable(this);
42
41
}
43
42
 
44
43
RenderWindow::RenderWindow(int x, int y, int w,int h,const char* titre, RENDER_WINDOW_TYPE type, int id):Fl_Gl_Window(x,y,w,h,titre), m_mouseButtonPressed(NO_BUTTON), m_resizable(false), m_fullscreen(false), m_type(type), m_grilleID(id), m_maxVerticesNb(1024), m_initialized(false)
49
48
        end();
50
49
        m_width=this->w();
51
50
        m_height=this->h();
 
51
    resizable(this);
52
52
}
53
53
 
54
54
RenderWindow::~RenderWindow()
388
388
void RenderWindow::toggleFullscreen()
389
389
{
390
390
        
391
 
        fl_open_display();
392
 
        XEvent xev;
393
 
        this->make_current();
394
 
        xev.xclient.type = ClientMessage;
395
 
        xev.xclient.serial = 0;
396
 
        xev.xclient.send_event = True;
397
 
        xev.xclient.message_type = XInternAtom(fl_display, "_NET_WM_STATE", False);
398
 
        xev.xclient.window = fl_xid(this);
399
 
        xev.xclient.format = 32;
400
 
        xev.xclient.data.l[0] = (m_fullscreen ? 0 : 1);
401
 
        xev.xclient.data.l[1] = XInternAtom(fl_display, "_NET_WM_STATE_FULLSCREEN", False);
402
 
        xev.xclient.data.l[2] = 0;
403
 
        xev.xclient.data.l[3] = 0;
404
 
        xev.xclient.data.l[4] = 0;
405
 
        XSendEvent(fl_display, DefaultRootWindow(fl_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
406
 
        XSync(fl_display, False);
407
 
 
408
391
        m_fullscreen = ! m_fullscreen;
409
392
 
410
393
        if(m_fullscreen) {
411
394
                cursor(FL_CURSOR_NONE);
 
395
        fullscreen();
412
396
        }
413
397
        else {
414
398
                cursor(FL_CURSOR_DEFAULT);
 
399
        fullscreen_off(0, 0, 800, 600);
415
400
        }
416
401
 
417
402
}