File: OSWindow.cpp

package info (click to toggle)
qtwebkit-opensource-src 5.212.0~alpha4-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 126,228 kB
  • sloc: cpp: 1,399,205; javascript: 111,961; ansic: 29,742; perl: 19,510; python: 13,364; ruby: 10,299; xml: 9,342; asm: 5,078; yacc: 2,166; lex: 906; sh: 417; makefile: 34
file content (85 lines) | stat: -rw-r--r-- 1,315 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

#include "OSWindow.h"

OSWindow::OSWindow()
    : mX(0),
      mY(0),
      mWidth(0),
      mHeight(0)
{
}

OSWindow::~OSWindow()
{}

int OSWindow::getX() const
{
    return mX;
}

int OSWindow::getY() const
{
    return mY;
}

int OSWindow::getWidth() const
{
    return mWidth;
}

int OSWindow::getHeight() const
{
    return mHeight;
}

bool OSWindow::popEvent(Event *event)
{
    if (mEvents.size() > 0 && event)
    {
        *event = mEvents.front();
        mEvents.pop_front();
        return true;
    }
    else
    {
        return false;
    }
}

void OSWindow::pushEvent(Event event)
{
    switch (event.Type)
    {
      case Event::EVENT_MOVED:
        mX = event.Move.X;
        mY = event.Move.Y;
        break;
      case Event::EVENT_RESIZED:
        mWidth = event.Size.Width;
        mHeight = event.Size.Height;
        break;
      default:
        break;
    }

    mEvents.push_back(event);
}

bool OSWindow::didTestEventFire()
{
    Event topEvent;
    while (popEvent(&topEvent))
    {
        if (topEvent.Type == Event::EVENT_TEST)
        {
            return true;
        }
    }

    return false;
}