midori/midori/midori-platform.h
Christian Dywan 89bae74a32 MIDORI_EVENT_NEW_TAB must check evt != NULL
In Ubuntu 12.04 Unity global menu evt is NULL
2012-05-13 02:22:38 +02:00

48 lines
1.4 KiB
C

/*
Copyright (C) 2010-2011 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
See the file COPYING for the full license text.
*/
#ifndef __MIDORI_PLATFORM_H__
#define __MIDORI_PLATFORM_H__ 1
#include "midori/midori-stock.h"
#include "katze/gtk3-compat.h"
#include "midori/gtkiconentry.h"
#include "midori/sokoke.h"
/* Common behavior modifiers */
#define MIDORI_MOD_NEW_WINDOW(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_NEW_TAB(state) (state & GDK_CONTROL_MASK)
#define MIDORI_MOD_BACKGROUND(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_SCROLL(state) (state & GDK_CONTROL_MASK)
#ifdef GDK_WINDOWING_QUARTZ
#define MIDORI_EVENT_CONTEXT_MENU(evt) \
((evt->button == 3) \
|| (evt->button == 1 && (evt->state & GDK_CONTROL_MASK)))
#else
#define MIDORI_EVENT_CONTEXT_MENU(evt) \
(evt->button == 3)
#endif
#define MIDORI_EVENT_NEW_TAB(evt) \
(evt != NULL \
&& ((((GdkEventButton*)evt)->button == 1 \
&& MIDORI_MOD_NEW_TAB(((GdkEventButton*)evt)->state)) \
|| (((GdkEventButton*)evt)->button == 2)))
#ifndef G_OS_WIN32
#define MIDORI_MODULE_PREFIX "lib"
#else
#define MIDORI_MODULE_PREFIX ""
#endif
#endif /* !__MIDORI_PLATFORM_H__ */