~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to src/mimxerrortrap.h

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2013-07-23 19:47:04 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: package-import@ubuntu.com-20130723194704-0o18p2ao0x9sa1zx
Tags: upstream-0.99.0+git20130615+97e8335
ImportĀ upstreamĀ versionĀ 0.99.0+git20130615+97e8335

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* * This file is part of Maliit framework *
2
 
 *
3
 
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
 
 * All rights reserved.
5
 
 *
6
 
 * Contact: maliit-discuss@lists.maliit.org
7
 
 *
8
 
 * This library is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU Lesser General Public
10
 
 * License version 2.1 as published by the Free Software Foundation
11
 
 * and appearing in the file LICENSE.LGPL included in the packaging
12
 
 * of this file.
13
 
 */
14
 
 
15
 
#ifndef MIMXERRORTRAP_H
16
 
#define MIMXERRORTRAP_H
17
 
 
18
 
#include "mimxextension.h"
19
 
 
20
 
#include <X11/Xlib.h>
21
 
 
22
 
/*! \internal
23
 
 * \ingroup maliitserver
24
 
 * \brief A helper class to enable trapping of X errors.
25
 
 *
26
 
 * \warning This class is not thread safe and must be only used in the main UI
27
 
 * thread.
28
 
 */
29
 
class MImXErrorTrap
30
 
{
31
 
public:
32
 
    //! Constructs a MImXErrorTrap object and start traping X errors with the specific
33
 
    //! \a majorCode and \a minorCode
34
 
    explicit MImXErrorTrap(int majorCode, int minorCode = 0);
35
 
    //! Constructs a MImXErrorTrap object and start traping X errors generated by
36
 
    //! \a extension with \a minorCode
37
 
    explicit MImXErrorTrap(const MImXExtension &extension, int minorCode);
38
 
    ~MImXErrorTrap();
39
 
 
40
 
    //! Flushes the X output buffer when \a sync. Stops trapping for the X error.
41
 
    //! Returns the error code for an error which occured or Success.
42
 
    int untrap(bool sync = true);
43
 
 
44
 
private:
45
 
    bool matches(XErrorEvent *e);
46
 
 
47
 
    int major_code;
48
 
    int minor_code;
49
 
    int error_code;
50
 
    XErrorHandler old_handler;
51
 
 
52
 
    friend int mim_x_error_handler(Display *, XErrorEvent *);
53
 
};
54
 
//! end_internal
55
 
 
56
 
#endif // MIMXERRORTRAP_H