~aleteoryx/muditaos

ref: 140cce4c8981263fcc14fc55a37354a2d555eb33 muditaos/module-services/service-eink/board/linux/renderer/src/RWindow.hpp -rw-r--r-- 1.4 KiB
140cce4c — Lucjan Bryndza [EGD-4029] Prevent call handler recursively (#927) 5 years ago
                                                                                
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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

/*
 * RWindow.hpp
 *
 *  Created on: 24 kwi 2019
 *      Author: robert
 */

#ifndef RENDERER_RWINDOW_HPP_
#define RENDERER_RWINDOW_HPP_

#include <map>
#include <cstdint>
#include <gtkmm.h>
#include <gtkmm/drawingarea.h>

#include "RArea.hpp"

#include "module-bsp/bsp/keyboard/key_codes.hpp"
class RWindow : public Gtk::Window
{
  protected:
    RArea drawArea;
    // pointer to shared memory with gui renderer buffer passed from main.
    char *shmMemPtr;
    // local buffer
    char *rgbMemPtr;
    // dimensions of the shared memory buffer
    int width, height;
    // map that holds pair of key, time
    //	pair is inserted into map when there is key event of GDK_KEY_PRESS
    // it is removed when there is GDK_KEY_RELEASE event
    std::map<uint32_t, uint32_t> keys;

    std::map<int8_t, uint32_t> keyMap;
    std::map<int8_t, uint32_t> batteryKeyMap;
    // named pipe file descriptor
    int fifoFd;
    // named pipe file descriptor
    int fifoFdBatt;
    void keyMapInit(void);

  public:
    RWindow(char *shmMemory, int fifoKbd, int fifoBatt, int w, int h);
    virtual ~RWindow();
    bool onKeyPress(GdkEventKey *event);
    bool onKeyRelease(GdkEventKey *event);

    void updateDrawBuffer();
};

#endif /* RENDERER_RWINDOW_HPP_ */