summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-03-06 15:28:32 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-03-11 12:11:36 +0100
commitc37701d41d9248a6131c67f31477e23ec2ead051 (patch)
tree7fa3eceac1af9c08e1873ff38aff60d916c50523
parent67fc1634045049041d0830c4381096cdd1641a7c (diff)
downloadqtlocation-mapboxgl-c37701d41d9248a6131c67f31477e23ec2ead051.tar.gz
accept --fullscreen option
Conflicts: linux/main.cpp
-rw-r--r--linux/main.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/linux/main.cpp b/linux/main.cpp
index 9923588084..a2271eb296 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -3,12 +3,15 @@
#include <llmr/platform/platform.hpp>
#include <signal.h>
+#include <getopt.h>
#include "settings.hpp"
#include "request.hpp"
std::forward_list<llmr::platform::Request *> requests;
+static int fullscreen_flag = 0;
+
class MapView {
public:
MapView() :
@@ -29,7 +32,9 @@ public:
GLFWmonitor *monitor = nullptr;
#ifdef GL_ES_VERSION_2_0
- monitor = glfwGetPrimaryMonitor();
+ if (fullscreen_flag) {
+ monitor = glfwGetPrimaryMonitor();
+ }
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
@@ -59,9 +64,8 @@ public:
glfwGetFramebufferSize(window, &fb_width, &fb_height);
settings.load();
- map.setup((double)fb_width / width);
- settings.load();
+ map.setup((double)fb_width / width);
resize(window, 0, 0);
@@ -133,6 +137,8 @@ public:
int fb_width, fb_height;
glfwGetFramebufferSize(window, &fb_width, &fb_height);
+ fprintf(stderr, "window size: %d/%d\n", width, height);
+
mapView->map.resize(width, height, fb_width, fb_height);
}
@@ -282,13 +288,26 @@ void quit_handler(int s) {
}
}
-int main() {
- // sigint handling
- struct sigaction sigIntHandler;
- sigIntHandler.sa_handler = quit_handler;
- sigemptyset(&sigIntHandler.sa_mask);
- sigIntHandler.sa_flags = 0;
- sigaction(SIGINT, &sigIntHandler, NULL);
+
+
+static struct option long_options[] = {
+ {"fullscreen", no_argument, &fullscreen_flag, 1},
+ {0, 0, 0, 0}
+};
+
+int main(int argc, char *argv[]) {
+ while (true) {
+ int option_index = 0;
+ int c = getopt_long(argc, argv, "f", long_options, &option_index);
+ if (c == -1) break;
+ }
+
+ // // sigint handling
+ // struct sigaction sigIntHandler;
+ // sigIntHandler.sa_handler = quit_handler;
+ // sigemptyset(&sigIntHandler.sa_mask);
+ // sigIntHandler.sa_flags = 0;
+ // sigaction(SIGINT, &sigIntHandler, NULL);
// curl init