ukui-window-switch/0000775000175000017500000000000013235751366013274 5ustar fengfengukui-window-switch/mainwindow.h0000664000175000017500000000464113235742216015620 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include "mylabel.h" #undef signals #include #define LINES 4 //Lines for displaying icons #define COLS 5 //Icons for each line #define TOP_SIZE 10 //Top reserved space #define BOTTOM_SIZE 50 //Bottom reserved space, including that for title #define LEFT_SIZE 10 //Right reserved space #define RIGHT_SIZE 10 //Right reserved space #define INTERVAL_WIDTH_SIZE 20 //Horizontal interval between two icons #define INTERVAL_HEIGHT_SIZE 20 //Vertical interval between two icons #define INTERVAL_TIME_MS 125 #define PREVIEW_WIDTH 168 #define PREVIEW_HEIGHT 128 #define SPACE_WIDTH 8 #define SPACE_HEIGHT 8 #define THUMBNAIL_WIDTH (PREVIEW_WIDTH - SPACE_WIDTH) #define THUMBNAIL_HEIGHT (PREVIEW_HEIGHT - SPACE_HEIGHT) #define ICON_WIDTH 48 #define ICON_HEIGHT 48 namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); private: bool ShowStatus; bool CanBeRelease; int WindowIndex; GList *global_tab_list; int WindowCount; QWidget *m_sub; QLabel *m_label; QList theLabels; QList theTitles; QList screen_widget; int maxY[LINES]; //Y for the highest icon each line int fontWidth, fontHeight; Ui::MainWindow *ui; private slots: void show_tab_list(int value); void show_forward(); void show_backward(); void slotMylabel(int index); void doAltRelease(); private: void hideWindow(); }; #endif // MAINWINDOW_H ukui-window-switch/keyeventmonitor.h0000664000175000017500000000243413235751312016701 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef KEYEVENTMONITOR_H #define KEYEVENTMONITOR_H #include #include #include class KeyEventMonitor : public QThread { Q_OBJECT public: KeyEventMonitor(QObject *parent = 0); Q_SIGNALS: void KeyAltRelease(); public Q_SLOTS: void isReleaseAlt(int code); protected: static void callback(XPointer trash, XRecordInterceptData *data); void handleRecordEvent(XRecordInterceptData *); void run(); private: bool isRelease; }; #endif // KEYEVENTMONITOR_H ukui-window-switch/COPYING0000644000175000017500000004325413222560631014322 0ustar fengfeng GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ukui-window-switch/README0000664000175000017500000000015013222560254014136 0ustar fengfeng#ukui-window-switch ======================= Front of the window switcher in UKUI desktop environment. ukui-window-switch/AUTHORS0000664000175000017500000000010413222561764014334 0ustar fengfengDroiing Buquan Liu ukui-window-switch/alt_tab_list.c0000664000175000017500000001054113235742216016074 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #undef signals #include #include #include #include #include #include #include #include "ukui_plugin_generated.h" #include "alt_tab_list.h" static GDBusConnection *pConnection = NULL; static UkwmPlugin *pProxy = NULL; char *newstr(char *old_str) { char *str = NULL; if (old_str == NULL) { str = malloc(1); if (str != NULL) *str = '\0'; } else { int l = strlen(old_str) + 1; str = malloc(l); if (str != NULL) strncpy(str, old_str, l); } return str; } alt_tab_item *new_alt_tab_item() { alt_tab_item *ati = malloc(sizeof(alt_tab_item)); memset(ati, 0x0, sizeof(alt_tab_item)); return ati; } void free_alt_tab_item(alt_tab_item *ati) { if (ati->title_name != NULL) free(ati->title_name); free(ati); } //GFunc free_alt_tab_item_from_glist(gpointer data, gpointer user_data) //{ // free_alt_tab_item((alt_tab_item *)data); //} bool UkwmPluginDBusServiceIsReady(void) { gchar *owner_name = NULL; owner_name = g_dbus_proxy_get_name_owner((GDBusProxy *)pProxy); if (owner_name != NULL) { // g_print("Owner Name: %s\n", owner_name); g_free(owner_name); return true; } else { // g_print("Owner Name is NULL.\n"); return false; } } bool InitUkwmPluginDBusComm(void) { bool bRet = TRUE; GError *pConnError = NULL; GError *pProxyError = NULL; //g_print("InitDBusCommunication: Client started.\n"); do { bRet = TRUE; /** First step: get a connection */ if (pConnection == NULL) pConnection = g_bus_get_sync(UKUI_PLUGIN_BUS, NULL, &pConnError); if (pConnection == NULL) { g_print("InitDBusCommunication: Failed to connect to dbus. Reason: %s.\n", pConnError->message); g_error_free(pConnError); bRet = FALSE; } /** Second step: try to get a connection to the given bus.*/ if (pProxy == NULL) pProxy = ukwm_plugin_proxy_new_sync(pConnection, G_DBUS_PROXY_FLAGS_NONE, UKUI_PLUGIN_BUS_NAME, UKUI_PLUGIN_OBJECT_PATH, NULL, &pProxyError); if (pProxy == NULL) { g_print("InitDBusCommunication: Failed to create proxy. Reason: %s.\n", pProxyError->message); g_error_free(pProxyError); bRet = FALSE; } g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(pProxy), G_MAXINT); } while (bRet == FALSE); return true; } void FinishUkwmPluginDBusComm(void) { g_object_ref(pConnection); g_object_ref(pProxy); pConnection = NULL; pProxy = NULL; } GList *DBusGetAltTabList(void) { GList *tab_list = NULL; gboolean bRet; int out_count = 0; GVariant *out_tab_list_gva; GError *error = NULL; bRet = ukwm_plugin_call_get_alt_tab_list_sync(pProxy, &out_count, &out_tab_list_gva, NULL, &error); if (bRet == FALSE) { printf("Can't get anything.\n"); return NULL; } char *title_name = NULL; GVariantIter *_iter; GVariant *_item; int i = 0; _iter = g_variant_iter_new(out_tab_list_gva); while (g_variant_iter_next(_iter, "v", &_item)) { alt_tab_item *ati = new_alt_tab_item(); g_variant_get(_item, "(siiiii)", &title_name, &ati->xid, &ati->width, &ati->height, &ati->x, &ati->y); ati->title_name = newstr(title_name); tab_list = g_list_append(tab_list, ati); g_variant_unref(_item); i++; } g_variant_iter_free(_iter); g_variant_unref(out_tab_list_gva); return tab_list; } void DBusActivateWindowByTabListIndex(int index) { gboolean bRet; bRet = ukwm_plugin_call_activate_window_by_tab_list_index_sync(pProxy, index, NULL, NULL); if (bRet == FALSE) { printf("Can't activate window: [%d]\n", index); } } ukui-window-switch/ukui-window-switch.pro0000664000175000017500000000170113222560254017564 0ustar fengfeng#------------------------------------------------- # # Project created by QtCreator 2017-07-24T20:25:09 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = ukui-window-switch TEMPLATE = app DESC_XML = data/org.ukui.ukwm.UkwmPlugin.xml GENERATED_CH = ukui_plugin_generated system(gdbus-codegen --interface org.ukui.ukwm --generate-c-code $${GENERATED_CH} $${DESC_XML}) SOURCES += main.cpp \ mainwindow.cpp \ alt_tab_list.c \ ukui_plugin_generated.c \ mylabel.cpp \ keyeventmonitor.cpp HEADERS += mainwindow.h alt_tab_list.h ukui_plugin_generated.h \ mylabel.h \ keyeventmonitor.h FORMS += mainwindow.ui include(qxtglobalshortcut/qxtglobalshortcut.pri) unix: CONFIG += link_pkgconfig unix: PKGCONFIG += gio-unix-2.0 gobject-2.0 gmodule-2.0 glib-2.0 xcb xcb-util x11 xext xtst DISTFILES += data/org.ukui.ukwm.UkwmPlugin.xml ukui-window-switch/man/0000775000175000017500000000000013223356020014030 5ustar fengfengukui-window-switch/man/ukui-window-switch.10000664000175000017500000000136413223356020017677 0ustar fengfeng.\" Man Page for ukui-window-switch .TH UKUI-WINDOW-SWITCH 1 "December 23, 2017" "UKUI Desktop Environment" .\" Please adjust this date when revising the manpage. .\" .SH "NAME" \fBukui-window-switch\fR \- Front of the window switcher in UKUI desktop environment .SH "SYNOPSIS" .B ukui-window-switch .SH "DESCRIPTION" Front of the window switcher in UKUI desktop environment. Provides the display function(Display window thumbnails and application icons) when the window is switching (press Alt+Tab key). .SH "BUGS" .SS Should you encounter any bugs, they may be reported at: http://github.com/ukui/ukui-window-switch/issues .SH "AUTHORS" .SS This Manual Page has been written for the UKUI Desktop Environment by: Droiing (2017) ukui-window-switch/data/0000775000175000017500000000000013222560254014173 5ustar fengfengukui-window-switch/data/org.ukui.ukwm.UkwmPlugin.xml0000664000175000017500000000102313222560254021537 0ustar fengfeng Get Device List Activate Window By Tab List Index ukui-window-switch/data/ukui-window-switch.desktop0000664000175000017500000000041613222560254021350 0ustar fengfeng[Desktop Entry] Type=Application Name=ukui-window-switch Name[zh_CN]=ukui-window-switch Comment=ukui window switch for ukwm Comment[zh_CN]=ukwm窗口切换 Exec=/usr/bin/ukui-window-switch StartupNotify=true NoDisplay=true Terminal=false Categories=GTK;Graphics;System; ukui-window-switch/mainwindow.ui0000664000175000017500000000163213222560254015777 0ustar fengfeng MainWindow 0 0 680 326 MainWindow 120 180 121 21 false Qt::AlignCenter ukui-window-switch/qxtglobalshortcut/0000775000175000017500000000000013235751361017060 5ustar fengfengukui-window-switch/qxtglobalshortcut/qxtglobalshortcut.h0000664000175000017500000000373113235742216023025 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) Qxt Foundation. Some rights reserved. ** ** This file is part of the QxtGui module of the Qxt library. ** ** This library is free software; you can redistribute it and/or modify it ** under the terms of the Common Public License, version 1.0, as published ** by IBM, and/or under the terms of the GNU Lesser General Public License, ** version 2.1, as published by the Free Software Foundation. ** ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR ** FITNESS FOR A PARTICULAR PURPOSE. ** ** You should have received a copy of the CPL and the LGPL along with this ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files ** included with the source distribution for more information. ** If you did not receive a copy of the licenses, contact the Qxt Foundation. ** ** ** ****************************************************************************/ #ifndef QXTGLOBALSHORTCUT_H #define QXTGLOBALSHORTCUT_H #include "qxtglobal.h" #include #include class QxtGlobalShortcutPrivate; class QxtGlobalShortcut : public QObject { Q_OBJECT QXT_DECLARE_PRIVATE(QxtGlobalShortcut) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) public: explicit QxtGlobalShortcut(QObject *parent = 0); explicit QxtGlobalShortcut(const QKeySequence &shortcut, QObject *parent = 0); virtual ~QxtGlobalShortcut(); QKeySequence shortcut() const; bool setShortcut(const QKeySequence &shortcut); bool isEnabled() const; public Q_SLOTS: void setEnabled(bool enabled = true); void setDisabled(bool disabled = true); Q_SIGNALS: void activated(); }; #endif // QXTGLOBALSHORTCUT_H ukui-window-switch/qxtglobalshortcut/qxtglobalshortcut_p.h0000664000175000017500000000473513235742216023351 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) Qxt Foundation. Some rights reserved. ** ** This file is part of the QxtGui module of the Qxt library. ** ** This library is free software; you can redistribute it and/or modify it ** under the terms of the Common Public License, version 1.0, as published ** by IBM, and/or under the terms of the GNU Lesser General Public License, ** version 2.1, as published by the Free Software Foundation. ** ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR ** FITNESS FOR A PARTICULAR PURPOSE. ** ** You should have received a copy of the CPL and the LGPL along with this ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files ** included with the source distribution for more information. ** If you did not receive a copy of the licenses, contact the Qxt Foundation. ** ** ** ****************************************************************************/ #ifndef QXTGLOBALSHORTCUT_P_H #define QXTGLOBALSHORTCUT_P_H #include "qxtglobalshortcut.h" #include #include #include #if(QT_VERSION>=0x050000) #include #endif class QxtGlobalShortcutPrivate : public QxtPrivate #if(QT_VERSION>=0x050000) , public QAbstractNativeEventFilter #endif { public: QXT_DECLARE_PUBLIC(QxtGlobalShortcut) QxtGlobalShortcutPrivate(); ~QxtGlobalShortcutPrivate(); bool enabled; Qt::Key key; Qt::KeyboardModifiers mods; bool setShortcut(const QKeySequence& shortcut); bool unsetShortcut(); static bool error; static int ref; #if(QT_VERSION<0x050000) static QAbstractEventDispatcher::EventFilter prevEventFilter; static bool eventFilter(void* message); #else bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); #endif private: static quint32 nativeKeycode(Qt::Key keycode); static quint32 nativeModifiers(Qt::KeyboardModifiers modifiers); static bool registerShortcut(quint32 nativeKey, quint32 nativeMods); static bool unregisterShortcut(quint32 nativeKey, quint32 nativeMods); static void activateShortcut(quint32 nativeKey, quint32 nativeMods); static QHash, QxtGlobalShortcut*> shortcuts; }; #endif // QXTGLOBALSHORTCUT_P_H ukui-window-switch/qxtglobalshortcut/qxtglobalshortcut.pri0000664000175000017500000000036713222560254023366 0ustar fengfengINCLUDEPATH += $$PWD DEPENDPATH += $$PWD HEADERS += $$PWD/qxtglobal.h \ $$PWD/qxtglobalshortcut.h \ $$PWD/qxtglobalshortcut_p.h SOURCES += $$PWD/qxtglobalshortcut.cpp unix:SOURCES += $$PWD/qxtglobalshortcut_x11.cpp QT += gui-private ukui-window-switch/qxtglobalshortcut/qxtglobalshortcut.cpp0000664000175000017500000001432713222560254023357 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) Qxt Foundation. Some rights reserved. ** ** This file is part of the QxtGui module of the Qxt library. ** ** This library is free software; you can redistribute it and/or modify it ** under the terms of the Common Public License, version 1.0, as published ** by IBM, and/or under the terms of the GNU Lesser General Public License, ** version 2.1, as published by the Free Software Foundation. ** ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR ** FITNESS FOR A PARTICULAR PURPOSE. ** ** You should have received a copy of the CPL and the LGPL along with this ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files ** included with the source distribution for more information. ** If you did not receive a copy of the licenses, contact the Qxt Foundation. ** ** ** ****************************************************************************/ #include "qxtglobalshortcut.h" #include "qxtglobalshortcut_p.h" #include #include #include bool QxtGlobalShortcutPrivate::error = false; int QxtGlobalShortcutPrivate::ref = 0; #if (QT_VERSION < 0x050000) QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0; #endif QHash, QxtGlobalShortcut *> QxtGlobalShortcutPrivate::shortcuts; QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier) { if (!ref++) { #if (QT_VERSION < 0x050000) prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter); #else QAbstractEventDispatcher::instance()->installNativeEventFilter(this); #endif } } QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() { if (!--ref) { #if (QT_VERSION < 0x050000) QAbstractEventDispatcher::instance()->setEventFilter(prevEventFilter); #else QAbstractEventDispatcher::instance()->removeNativeEventFilter(this); #endif } } bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence &shortcut) { Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier; key = shortcut.isEmpty() ? Qt::Key(0) : Qt::Key((shortcut[0] ^ allMods) & shortcut[0]); mods = shortcut.isEmpty() ? Qt::KeyboardModifiers(0) : Qt::KeyboardModifiers(shortcut[0] & allMods); const quint32 nativeKey = nativeKeycode(key); const quint32 nativeMods = nativeModifiers(mods); const bool res = registerShortcut(nativeKey, nativeMods); shortcuts.insert(qMakePair(nativeKey, nativeMods), &qxt_p()); if (!res) qWarning() << "QxtGlobalShortcut failed to register:" << QKeySequence(key + mods).toString(); return res; } bool QxtGlobalShortcutPrivate::unsetShortcut() { const quint32 nativeKey = nativeKeycode(key); const quint32 nativeMods = nativeModifiers(mods); const bool res = unregisterShortcut(nativeKey, nativeMods); shortcuts.remove(qMakePair(nativeKey, nativeMods)); if (!res) qWarning() << "QxtGlobalShortcut failed to unregister:" << QKeySequence(key + mods).toString(); key = Qt::Key(0); mods = Qt::KeyboardModifiers(0); return res; } void QxtGlobalShortcutPrivate::activateShortcut(quint32 nativeKey, quint32 nativeMods) { QxtGlobalShortcut *shortcut = shortcuts.value(qMakePair(nativeKey, nativeMods)); if (shortcut && shortcut->isEnabled()) emit shortcut->activated(); } /*! \class QxtGlobalShortcut \inmodule QxtGui \brief The QxtGlobalShortcut class provides a global shortcut aka "hotkey". A global shortcut triggers even if the application is not active. This makes it easy to implement applications that react to certain shortcuts still if some other application is active or if the application is for example minimized to the system tray. Example usage: \code QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(window); connect(shortcut, SIGNAL(activated()), window, SLOT(toggleVisibility())); shortcut->setShortcut(QKeySequence("Ctrl+Shift+F12")); \endcode \bold {Note:} Since Qxt 0.6 QxtGlobalShortcut no more requires QxtApplication. */ /*! \fn QxtGlobalShortcut::activated() This signal is emitted when the user types the shortcut's key sequence. \sa shortcut */ /*! Constructs a new QxtGlobalShortcut with \a parent. */ QxtGlobalShortcut::QxtGlobalShortcut(QObject *parent) : QObject(parent) { QXT_INIT_PRIVATE(QxtGlobalShortcut); } /*! Constructs a new QxtGlobalShortcut with \a shortcut and \a parent. */ QxtGlobalShortcut::QxtGlobalShortcut(const QKeySequence &shortcut, QObject *parent) : QObject(parent) { QXT_INIT_PRIVATE(QxtGlobalShortcut); int times = 0; while ((!setShortcut(shortcut)) && (times < 30)) { times++; printf("Register shortcut failed[%d], will retry\n", times); sleep(1); }; } /*! Destructs the QxtGlobalShortcut. */ QxtGlobalShortcut::~QxtGlobalShortcut() { if (qxt_d().key != 0) qxt_d().unsetShortcut(); } /*! \property QxtGlobalShortcut::shortcut \brief the shortcut key sequence \bold {Note:} Notice that corresponding key press and release events are not delivered for registered global shortcuts even if they are disabled. Also, comma separated key sequences are not supported. Only the first part is used: \code qxtShortcut->setShortcut(QKeySequence("Ctrl+Alt+A,Ctrl+Alt+B")); Q_ASSERT(qxtShortcut->shortcut() == QKeySequence("Ctrl+Alt+A")); \endcode */ QKeySequence QxtGlobalShortcut::shortcut() const { return QKeySequence(qxt_d().key | qxt_d().mods); } bool QxtGlobalShortcut::setShortcut(const QKeySequence &shortcut) { if (qxt_d().key != 0) qxt_d().unsetShortcut(); return qxt_d().setShortcut(shortcut); } /*! \property QxtGlobalShortcut::enabled \brief whether the shortcut is enabled A disabled shortcut does not get activated. The default value is \c true. \sa setDisabled() */ bool QxtGlobalShortcut::isEnabled() const { return qxt_d().enabled; } void QxtGlobalShortcut::setEnabled(bool enabled) { qxt_d().enabled = enabled; } /*! Sets the shortcut \a disabled. \sa enabled */ void QxtGlobalShortcut::setDisabled(bool disabled) { qxt_d().enabled = !disabled; } ukui-window-switch/qxtglobalshortcut/qxtglobal.h0000664000175000017500000001250713235742216021232 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) Qxt Foundation. Some rights reserved. ** ** This file is part of the QxtCore module of the Qxt library. ** ** This library is free software; you can redistribute it and/or modify it ** under the terms of the Common Public License, version 1.0, as published ** by IBM, and/or under the terms of the GNU Lesser General Public License, ** version 2.1, as published by the Free Software Foundation. ** ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR ** FITNESS FOR A PARTICULAR PURPOSE. ** ** You should have received a copy of the CPL and the LGPL along with this ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files ** included with the source distribution for more information. ** If you did not receive a copy of the licenses, contact the Qxt Foundation. ** ** ** ****************************************************************************/ #ifndef QXTGLOBAL_H #define QXTGLOBAL_H #include #define QXT_VERSION 0x000600 #define QXT_VERSION_STR "0.6.0" //--------------------------global macros------------------------------ #ifndef QXT_NO_MACROS #endif // QXT_NO_MACROS //--------------------------export macros------------------------------ #define QXT_DLLEXPORT DO_NOT_USE_THIS_ANYMORE #if !defined(QXT_STATIC) #if defined(BUILD_QXT_CORE) #define QXT_CORE_EXPORT Q_DECL_EXPORT #else #define QXT_CORE_EXPORT Q_DECL_IMPORT #endif #else #define QXT_CORE_EXPORT #endif // BUILD_QXT_CORE #if !defined(QXT_STATIC) #if defined(BUILD_QXT_GUI) #define QXT_GUI_EXPORT Q_DECL_EXPORT #else #define QXT_GUI_EXPORT Q_DECL_IMPORT #endif #else #define QXT_GUI_EXPORT #endif // BUILD_QXT_GUI #if !defined(QXT_STATIC) #if defined(BUILD_QXT_NETWORK) #define QXT_NETWORK_EXPORT Q_DECL_EXPORT #else #define QXT_NETWORK_EXPORT Q_DECL_IMPORT #endif #else #define QXT_NETWORK_EXPORT #endif // BUILD_QXT_NETWORK #if !defined(QXT_STATIC) #if defined(BUILD_QXT_SQL) #define QXT_SQL_EXPORT Q_DECL_EXPORT #else #define QXT_SQL_EXPORT Q_DECL_IMPORT #endif #else #define QXT_SQL_EXPORT #endif // BUILD_QXT_SQL #if !defined(QXT_STATIC) #if defined(BUILD_QXT_WEB) #define QXT_WEB_EXPORT Q_DECL_EXPORT #else #define QXT_WEB_EXPORT Q_DECL_IMPORT #endif #else #define QXT_WEB_EXPORT #endif // BUILD_QXT_WEB #if !defined(QXT_STATIC) #if defined(BUILD_QXT_BERKELEY) #define QXT_BERKELEY_EXPORT Q_DECL_EXPORT #else #define QXT_BERKELEY_EXPORT Q_DECL_IMPORT #endif #else #define QXT_BERKELEY_EXPORT #endif // BUILD_QXT_BERKELEY #if !defined(QXT_STATIC) #if defined(BUILD_QXT_ZEROCONF) #define QXT_ZEROCONF_EXPORT Q_DECL_EXPORT #else #define QXT_ZEROCONF_EXPORT Q_DECL_IMPORT #endif #else #define QXT_ZEROCONF_EXPORT #endif // QXT_ZEROCONF_EXPORT #if defined BUILD_QXT_CORE || defined BUILD_QXT_GUI || defined BUILD_QXT_SQL || defined BUILD_QXT_NETWORK || defined BUILD_QXT_WEB || defined BUILD_QXT_BERKELEY || defined BUILD_QXT_ZEROCONF #define BUILD_QXT #endif QXT_CORE_EXPORT const char *qxtVersion(); #ifndef QT_BEGIN_NAMESPACE #define QT_BEGIN_NAMESPACE #endif #ifndef QT_END_NAMESPACE #define QT_END_NAMESPACE #endif #ifndef QT_FORWARD_DECLARE_CLASS #define QT_FORWARD_DECLARE_CLASS(Class) class Class; #endif /**************************************************************************** ** This file is derived from code bearing the following notice: ** The sole author of this file, Adam Higerd, has explicitly disclaimed all ** copyright interest and protection for the content within. This file has ** been placed in the public domain according to United States copyright ** statute and case law. In jurisdictions where this public domain dedication ** is not legally recognized, anyone who receives a copy of this file is ** permitted to use, modify, duplicate, and redistribute this file, in whole ** or in part, with no restrictions or conditions. In these jurisdictions, ** this file shall be copyright (C) 2006-2008 by Adam Higerd. ****************************************************************************/ #define QXT_DECLARE_PRIVATE(PUB) \ friend class PUB##Private; \ QxtPrivateInterface qxt_d; #define QXT_DECLARE_PUBLIC(PUB) friend class PUB; #define QXT_INIT_PRIVATE(PUB) qxt_d.setPublic(this); #define QXT_D(PUB) PUB##Private &d = qxt_d() #define QXT_P(PUB) PUB &p = qxt_p() template class QxtPrivate { public: virtual ~QxtPrivate() { } inline void QXT_setPublic(PUB *pub) { qxt_p_ptr = pub; } protected: inline PUB &qxt_p() { return *qxt_p_ptr; } inline const PUB &qxt_p() const { return *qxt_p_ptr; } private: PUB *qxt_p_ptr; }; template class QxtPrivateInterface { friend class QxtPrivate; public: QxtPrivateInterface() { pvt = new PVT; } ~QxtPrivateInterface() { delete pvt; } inline void setPublic(PUB *pub) { pvt->QXT_setPublic(pub); } inline PVT &operator()() { return *static_cast(pvt); } inline const PVT &operator()() const { return *static_cast(pvt); } private: QxtPrivateInterface(const QxtPrivateInterface &) {} QxtPrivateInterface &operator=(const QxtPrivateInterface &) {} QxtPrivate *pvt; }; #endif // QXT_GLOBAL ukui-window-switch/qxtglobalshortcut/qxtglobalshortcut_x11.cpp0000664000175000017500000001550313235747106024054 0ustar fengfeng#include "qxtglobalshortcut_p.h" /**************************************************************************** ** Copyright (c) 2006 - 2011, the LibQxt project. ** See the Qxt AUTHORS file for a list of authors and copyright holders. ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** * Neither the name of the LibQxt project nor the ** names of its contributors may be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ** DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** ** *****************************************************************************/ #include #if QT_VERSION < QT_VERSION_CHECK(5,0,0) # include #else # include # include "qpa/qplatformnativeinterface.h" # include #endif #include namespace { const QVector maskModifiers = QVector() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask); typedef int (*X11ErrorHandler)(Display *display, XErrorEvent *event); class QxtX11ErrorHandler { public: static bool error; static int qxtX11ErrorHandler(Display *display, XErrorEvent *event) { Q_UNUSED(display); switch (event->error_code) { case BadAccess: case BadValue: case BadWindow: if (event->request_code == 33 /* X_GrabKey */ || event->request_code == 34 /* X_UngrabKey */) { error = true; //TODO: //char errstr[256]; //XGetErrorText(dpy, err->error_code, errstr, 256); } } return 0; } QxtX11ErrorHandler() { error = false; m_previousErrorHandler = XSetErrorHandler(qxtX11ErrorHandler); } ~QxtX11ErrorHandler() { XSetErrorHandler(m_previousErrorHandler); } private: X11ErrorHandler m_previousErrorHandler; }; bool QxtX11ErrorHandler::error = false; class QxtX11Data { public: QxtX11Data() { #if QT_VERSION < QT_VERSION_CHECK(5,0,0) m_display = QX11Info::display(); #else QPlatformNativeInterface *native = qApp->platformNativeInterface(); void *display = native->nativeResourceForScreen(QByteArray("display"), QGuiApplication::primaryScreen()); m_display = reinterpret_cast(display); #endif } bool isValid() { return m_display != 0; } Display *display() { Q_ASSERT(isValid()); return m_display; } Window rootWindow() { return DefaultRootWindow(display()); } bool grabKey(quint32 keycode, quint32 modifiers, Window window) { QxtX11ErrorHandler errorHandler; for (int i = 0; !errorHandler.error && i < maskModifiers.size(); ++i) { XGrabKey(display(), keycode, modifiers | maskModifiers[i], window, True, GrabModeAsync, GrabModeAsync); } if (errorHandler.error) { ungrabKey(keycode, modifiers, window); return false; } return true; } bool ungrabKey(quint32 keycode, quint32 modifiers, Window window) { QxtX11ErrorHandler errorHandler; foreach (quint32 maskMods, maskModifiers) { XUngrabKey(display(), keycode, modifiers | maskMods, window); } return !errorHandler.error; } private: Display *m_display; }; } // namespace #if QT_VERSION < QT_VERSION_CHECK(5,0,0) bool QxtGlobalShortcutPrivate::eventFilter(void *message) { XEvent *event = static_cast(message); if (event->type == KeyPress) { XKeyEvent *key = reinterpret_cast(event); unsigned int keycode = key->keycode; unsigned int keystate = key->state; #else bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType, void *message, long *result) { Q_UNUSED(result); xcb_key_press_event_t *kev = 0; if (eventType == "xcb_generic_event_t") { xcb_generic_event_t *ev = static_cast(message); if ((ev->response_type & 127) == XCB_KEY_PRESS) kev = static_cast(message); } if (kev != 0) { unsigned int keycode = kev->detail; unsigned int keystate = 0; if(kev->state & XCB_MOD_MASK_1) keystate |= Mod1Mask; if(kev->state & XCB_MOD_MASK_CONTROL) keystate |= ControlMask; if(kev->state & XCB_MOD_MASK_4) keystate |= Mod4Mask; if(kev->state & XCB_MOD_MASK_SHIFT) keystate |= ShiftMask; #endif activateShortcut(keycode, // Mod1Mask == Alt, Mod4Mask == Meta keystate & (ShiftMask | ControlMask | Mod1Mask | Mod4Mask)); } #if QT_VERSION < QT_VERSION_CHECK(5,0,0) return prevEventFilter ? prevEventFilter(message) : false; #else return false; #endif } quint32 QxtGlobalShortcutPrivate::nativeModifiers(Qt::KeyboardModifiers modifiers) { // ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, and Mod5Mask quint32 native = 0; if (modifiers & Qt::ShiftModifier) native |= ShiftMask; if (modifiers & Qt::ControlModifier) native |= ControlMask; if (modifiers & Qt::AltModifier) native |= Mod1Mask; if (modifiers & Qt::MetaModifier) native |= Mod4Mask; // TODO: resolve these? //if (modifiers & Qt::MetaModifier) //if (modifiers & Qt::KeypadModifier) //if (modifiers & Qt::GroupSwitchModifier) return native; } quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) { QxtX11Data x11; if (!x11.isValid()) return 0; KeySym keysym = XStringToKeysym(QKeySequence(key).toString().toLatin1().data()); if (keysym == NoSymbol) keysym = static_cast(key); return XKeysymToKeycode(x11.display(), keysym); } bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods) { QxtX11Data x11; return x11.isValid() && x11.grabKey(nativeKey, nativeMods, x11.rootWindow()); } bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nativeMods) { QxtX11Data x11; return x11.isValid() && x11.ungrabKey(nativeKey, nativeMods, x11.rootWindow()); } ukui-window-switch/mylabel.h0000664000175000017500000000247413235751310015066 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef MY_LABEL_H #define MY_LABEL_H #include #include #include class MyLabel : public QLabel { Q_OBJECT public: explicit MyLabel(int index, const QString &text = "", QWidget *parent = 0); ~MyLabel(); signals: void myclicked(int); protected: void mousePressEvent(QMouseEvent *event); public: void setBrightColor(); void setHideColor(); QString getTitle(); void setTitle(QString title); int getIndex(); void setIndex(int index); private: int m_index; QString m_title; }; #endif //MY_LABEL_H ukui-window-switch/mainwindow.cpp0000664000175000017500000002757313235742216016164 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include #include "mainwindow.h" #include "ui_mainwindow.h" #include "qxtglobalshortcut.h" #include #include #include #include #include #include #include #include "keyeventmonitor.h" #undef signals extern "C" { #include #include } char tab_list_image_file[PATH_MAX_LEN] = {0}; char workspace_image_file[PATH_MAX_LEN] = {0}; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QDesktopWidget *desktop = QApplication::desktop(); move((desktop->width() - this->width()) / 2, (desktop->height() - this->height()) / 2); this->ShowStatus = false; this->CanBeRelease = true; for (int i = 0; i < LINES; i++) maxY[i] = 0; this->WindowIndex = 0; this->setAttribute(Qt::WA_TranslucentBackground, true); m_sub = new QWidget(this); m_sub->move((desktop->width() - this->width()) / 2, (desktop->height() - this->height()) / 2); m_label = new QLabel(m_sub); m_sub->setStyleSheet("background-color:rgba(0, 0, 0, 216);" "border-radius: 8px;" "border-color: rgb(200, 200, 200);" "border-style:solid;" "border-width:2px;"); //QFont font("Arial", 30, QFont::Bold); QFont font("Microsoft YaHei", 10, 50); m_label->setFont(font); m_label->setAlignment(Qt::AlignCenter); m_label->setStyleSheet("background-color: transparent;" "border: 0px; color: white"); QFontMetrics fm(font); fontWidth = fm.maxWidth(); fontHeight = fm.height(); QxtGlobalShortcut *sc = new QxtGlobalShortcut(QKeySequence("Alt+Tab"), this); QxtGlobalShortcut *sc_u = new QxtGlobalShortcut(QKeySequence("Alt+Shift+Tab"), this); if (sc == NULL or sc_u == NULL) { printf("Can not register shortcut, exit...\n"); QApplication::exit(1); } connect(sc, SIGNAL(activated()), this, SLOT(show_forward())); connect(sc_u, SIGNAL(activated()), this, SLOT(show_backward())); KeyEventMonitor *kem = new KeyEventMonitor; connect(kem, SIGNAL(KeyAltRelease()), this, SLOT(doAltRelease())); kem->start(); //QWidget::installEventFilter(this); //Install event filter for this window. snprintf(tab_list_image_file, PATH_MAX_LEN, "/run/user/%d/%s", getuid(), TAB_LIST_IMAGE_FILE); } MainWindow::~MainWindow() { for (int i = 0; i < theLabels.size(); i++) delete theLabels[i]; theLabels.clear(); theTitles.clear(); delete m_label; delete m_sub; delete ui; } QPixmap qimageFromXImage(XImage* ximage) { QImage::Format format = QImage::Format_ARGB32_Premultiplied; if (ximage->depth == 24) format = QImage::Format_RGB32; else if (ximage->depth == 16) format = QImage::Format_RGB16; QImage image = QImage(reinterpret_cast(ximage->data), ximage->width, ximage->height, ximage->bytes_per_line, format).copy(); // Little Endian or Big Endian? if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && ximage->byte_order == MSBFirst) || (QSysInfo::ByteOrder == QSysInfo::BigEndian && ximage->byte_order == LSBFirst)) { for (int i = 0; i < image.height(); i++) { if (ximage->depth == 16) { ushort* p = reinterpret_cast(image.scanLine(i)); ushort* end = p + image.width(); while (p < end) { *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); p++; } } else { uint* p = reinterpret_cast(image.scanLine(i)); uint* end = p + image.width(); while (p < end) { *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); p++; } } } } // Fix alpha channel if (format == QImage::Format_RGB32) { QRgb* p = reinterpret_cast(image.bits()); for (int y = 0; y < ximage->height; ++y) { for (int x = 0; x < ximage->width; ++x) p[x] |= 0xff000000; p += ximage->bytes_per_line / 4; } } return QPixmap::fromImage(image); } void MainWindow::show_forward() { show_tab_list(1); } void MainWindow::show_backward() { show_tab_list(-1); } void MainWindow::show_tab_list(int value) { static unsigned long tabPreviousTime = 0; unsigned long tabCurrentTime = 0; tabCurrentTime = QDateTime::currentMSecsSinceEpoch(); if (tabCurrentTime - tabPreviousTime < INTERVAL_TIME_MS) { return; } tabPreviousTime = tabCurrentTime; this->CanBeRelease = false; if (!this->ShowStatus) { for (int i = 0; i < LINES; i++) maxY[i] = 0; theLabels.clear(); InitUkwmPluginDBusComm(); while (!UkwmPluginDBusServiceIsReady()) { usleep(1000); } this->global_tab_list = DBusGetAltTabList(); this->WindowCount = g_list_length(this->global_tab_list); FinishUkwmPluginDBusComm(); if (this->WindowCount == 0) { this->CanBeRelease = true; return; } this->ShowStatus = true; //Generate min{20, this->WindowCount} labels int total = LINES * COLS; int n_labels = total; //How many labels will be showed? if (total > this->WindowCount) n_labels = this->WindowCount; int lines; lines = n_labels / COLS; if (lines * COLS < n_labels) lines++; int i; XImage *img = NULL; Display *display = NULL; XWindowAttributes attr; GList *tab_list = this->global_tab_list; display = XOpenDisplay(NULL); for (i = 0; i < this->WindowCount; i++) { int myline = i / COLS; //line is from 0 //int mycol = i % COLS; //col is from 0 //Produce icon alt_tab_item *ati = NULL; ati = (alt_tab_item *)g_list_nth_data(tab_list, i); theTitles.append(QString(ati->title_name)); if (myline < LINES) { if (maxY[myline] < PREVIEW_HEIGHT) maxY[myline] = PREVIEW_HEIGHT; //Compute myx int j; int myx = LEFT_SIZE; for (j = myline * COLS; j < i; j++) { myx += theLabels[j]->width(); myx += INTERVAL_WIDTH_SIZE; } //Compute myy int myy = TOP_SIZE; for (j = 0; j < myline; j++) { myy += maxY[j]; myy += INTERVAL_HEIGHT_SIZE; } QPixmap pixmap; pixmap.load(tab_list_image_file); MyLabel *one = new MyLabel(i, ati->title_name, m_sub); one->move(myx, myy); one->resize(PREVIEW_WIDTH, PREVIEW_HEIGHT); XGetWindowAttributes(display, ati->xid, &attr); img = XGetImage(display, ati->xid, 0, 0, attr.width, attr.height, 0xffffffff, ZPixmap); QPixmap thumbnail = qimageFromXImage(img).scaled(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, Qt::KeepAspectRatio, Qt::FastTransformation); XDestroyImage(img); QPixmap icon = pixmap.copy(ati->x, ati->y, ati->width, ati->height). scaled(ICON_WIDTH, ICON_HEIGHT, Qt::KeepAspectRatio, Qt::FastTransformation); QPixmap preview(PREVIEW_WIDTH, PREVIEW_HEIGHT); preview.fill(Qt::transparent); QPainter painter(&preview); QRect source; QRect target; source = QRect(0, 0, thumbnail.width(), thumbnail.height()); target = QRect((THUMBNAIL_WIDTH - thumbnail.width()) / 2, (THUMBNAIL_HEIGHT - thumbnail.height()) / 2, thumbnail.width(), thumbnail.height()); painter.drawPixmap(target, thumbnail, source); source = QRect(0, 0, icon.width(), icon.height()); target = QRect(PREVIEW_WIDTH -ICON_WIDTH, PREVIEW_HEIGHT - ICON_HEIGHT, icon.width(), icon.height()); painter.drawPixmap(target, icon, source); painter.end(); one->setPixmap(preview); theLabels.append(one); connect(one, SIGNAL(myclicked(int)), this, SLOT(slotMylabel(int))); } } XCloseDisplay(display); //Compute the size (wx, wy) of the whole window. int j; int max_width = 0; for (i = 0; i < lines; i++) { int wx = LEFT_SIZE; for (j = 0; j < COLS; j++) { if ((i * COLS + j) >= n_labels) break; wx += theLabels[i * COLS + j]->width(); wx += INTERVAL_HEIGHT_SIZE; } wx = wx - INTERVAL_HEIGHT_SIZE + RIGHT_SIZE; if (max_width < wx) max_width = wx; } int max_height = TOP_SIZE; for (i = 0; i < lines; i++) { max_height += maxY[i]; max_height += INTERVAL_HEIGHT_SIZE; } max_height = max_height - INTERVAL_HEIGHT_SIZE + BOTTOM_SIZE; m_sub->resize(max_width, max_height); QDesktopWidget *desktop = QApplication::desktop(); QRect screen_rect; int s_num = desktop->screenCount(); int ps_idx = desktop->primaryScreen(); for (i = 0; i < screen_widget.length(); i++) { screen_widget[i]->hide(); } //For multiple screens, use transparent QMainWindow to prevent clicking the mouse in other screens. for (i = 0; i < s_num; i++) { if ((i + 1) > screen_widget.length()) { screen_widget.append(new QMainWindow(this)); screen_widget[i]->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool); screen_widget[i]->setWindowState(Qt::WindowActive); screen_widget[i]->setAttribute(Qt::WA_TranslucentBackground); screen_widget[i]->setWindowOpacity(0); } if (i != ps_idx) { screen_rect = desktop->screenGeometry(i); screen_widget[i]->setGeometry(screen_rect); screen_widget[i]->showFullScreen(); } } screen_rect = desktop->screenGeometry(ps_idx); this->move(screen_rect.x(), screen_rect.y()); m_sub->move((screen_rect.width() - m_sub->width()) / 2, (screen_rect.height() - m_sub->height()) / 2); } //this->setWindowState(Qt::WindowActive); this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool); this->activateWindow(); this->showFullScreen(); m_sub->show(); fflush(stdout); int count = this->WindowCount; int index = this->WindowIndex; for (int i = 0; i < theLabels.size(); i++) theLabels[i]->setHideColor(); index = (index + count + value) % count; this->WindowIndex = index; m_label->setText(""); if (index < LINES * COLS) { theLabels[index]->setBrightColor(); } m_label->setText(theTitles[index]); //All visible and invisible windows have their own titles. m_label->resize(m_sub->width() - 10, 20); m_label->move((m_sub->width() - m_label->width()) / 2, m_sub->height() - m_label->height() - 15); this->CanBeRelease = true; } void MainWindow::keyPressEvent(QKeyEvent *event) { unsigned int modifiers = event->modifiers() & Qt::KeyboardModifierMask; if ((event->key() == Qt::Key_Tab) || (event->key() == Qt::Key_Backtab)) { if (modifiers == Qt::AltModifier) show_tab_list(1); if (modifiers == (Qt::ShiftModifier | Qt::AltModifier)) show_tab_list(-1); } } void MainWindow::keyReleaseEvent(QKeyEvent *event) { QWidget::keyReleaseEvent(event); } void MainWindow::slotMylabel(int index) { for (int i = 0; i < theLabels.size(); i++) theLabels[i]->setHideColor(); this->WindowIndex = index; hideWindow(); } void MainWindow::hideWindow() { if (this->ShowStatus) { int i = 0; for (i = 0; i < theLabels.size(); i++) delete theLabels[i]; theLabels.clear(); theTitles.clear(); for (i = 0; i < screen_widget.length(); i++) screen_widget[i]->hide(); InitUkwmPluginDBusComm(); DBusActivateWindowByTabListIndex(this->WindowIndex); FinishUkwmPluginDBusComm(); this->hide(); this->ShowStatus = false; this->WindowIndex = 0; } } void MainWindow::doAltRelease() { int times = 0; while ((!this->CanBeRelease) && (times <= 10)) { times++; usleep(100 * 1000); } this->hideWindow(); } ukui-window-switch/mylabel.cpp0000664000175000017500000000315213235742216015420 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include "mylabel.h" MyLabel::MyLabel(int index, const QString &text, QWidget *parent) : QLabel(parent) { //setText(text); m_index = index; m_title = text; } MyLabel::~MyLabel() { } void MyLabel::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { emit myclicked(m_index); setBrightColor(); } QLabel::mousePressEvent(event); //deliver the event to parent class. } void MyLabel::setBrightColor() { setStyleSheet("background-color: transparent; border: 2px solid white"); } void MyLabel::setHideColor() { setStyleSheet("background-color: transparent; border: 2px solid transparent"); } QString MyLabel::getTitle() { return m_title; } void MyLabel::setTitle(QString title) { m_title = title; } int MyLabel::getIndex() { return m_index; } void MyLabel::setIndex(int index) { m_index = index; } ukui-window-switch/keyeventmonitor.cpp0000664000175000017500000000746613235751366017257 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include "keyeventmonitor.h" #include #include #include KeyEventMonitor::KeyEventMonitor(QObject *parent) : QThread(parent) { //Whether the mouse is pressed, used to identify the drag and drop operation of the mouse isRelease = false; } void KeyEventMonitor::run() { // Open a connection to the X server that controls a display. Display *display = XOpenDisplay(0); if (display == 0) { fprintf(stderr, "unable to open display\n"); return; } // Initialize the parameters for the function of XRecordCreateContext. // XRecordAllClients means recording all events of X Client. XRecordClientSpec clients = XRecordAllClients; // Control the range of recording events. XRecordRange *range = XRecordAllocRange(); if (range == 0) { fprintf(stderr, "unable to allocate XRecordRange\n"); return; } // Initialize range. // Only five types of events: KeyPress, KeyRelase, ButtonPress, ButtonRelease, MotionNotify. memset(range, 0, sizeof(XRecordRange)); range->device_events.first = KeyPress; range->device_events.last = MotionNotify; // Create the record context by clients and range. // The variable is as the paratemer of XRecordEnableContext for event loop. XRecordContext context = XRecordCreateContext(display, 0, &clients, 1, &range, 1); if (context == 0) { fprintf(stderr, "XRecordCreateContext failed\n"); return; } XFree(range); // Flush the output buffer and then waits until all requests have been received and processed by the X server. XSync(display, True); // Returns a Display structure that serves as the connection to the X server and that contains all the information about that X server. Display *display_datalink = XOpenDisplay(0); if (display_datalink == 0) { fprintf(stderr, "unable to open second display\n"); return; } // Call XRecordEnableContext to build the XRecord context and enter the event loop. // The callback function will be evoked on receiving an event from X Server. if (!XRecordEnableContext(display_datalink, context, callback, (XPointer)this)) { fprintf(stderr, "XRecordEnableContext() failed\n"); return; } } // To wrap the handleRecordEvent function to avoid that the code about XRecord can not be compiled. void KeyEventMonitor::callback(XPointer ptr, XRecordInterceptData *data) { ((KeyEventMonitor *)ptr)->handleRecordEvent(data); } // The callback function to handle the event from X Server. void KeyEventMonitor::handleRecordEvent(XRecordInterceptData *data) { if (data->category == XRecordFromServer) { xEvent *event = (xEvent *)data->data; switch (event->u.u.type) { case ButtonPress: //printf("X11 ButtonPress\n"); break; case ButtonRelease: //printf("X11 ButtonRelease\n"); break; case KeyPress: //printf("X11 KeyPress\n"); break; case KeyRelease: //printf("X11 KeyRelease\n"); this->isReleaseAlt(((unsigned char *)data->data)[1]); break; default: break; } } fflush(stdout); XRecordFreeData(data); } void KeyEventMonitor::isReleaseAlt(int code) { if (code == 64) { emit KeyAltRelease(); } } ukui-window-switch/main.cpp0000664000175000017500000000511713235742216014722 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include "mainwindow.h" #include #include #include "qxtglobalshortcut.h" #include #include #include #include #include #define PROGRAM_NAME "ukui-window-switch" #define PATH_MAX_LEN 1024 #define PID_STRING_LEN 64 #define SHORTCAT_REG_DELAY 6 /* * Check if another process is running. * Input: program name * Return: * 0 No another process is running. * 1 Another process is running. * <0 Exception. */ int checkProcessRunning(const char *processName) { int uid = getuid(); int pid = getpid(); char pid_file[PATH_MAX_LEN] = {0}; char pid_string[PID_STRING_LEN] = {0}; snprintf(pid_file, PATH_MAX_LEN, "/run/user/%d/%s.pid", uid, processName); int pid_file_fd = open(pid_file, O_CREAT | O_TRUNC | O_RDWR, 0666); if (pid_file_fd < 0) { fprintf(stderr, "Can not open pid file: %s\n", pid_file); return -1; } int lock_ret = flock(pid_file_fd, LOCK_EX | LOCK_NB); if (lock_ret < 0) { struct passwd *pwd = getpwuid(uid); fprintf(stdout, "User %s[%d] has run %s, the current program exits.\n", pwd->pw_name, uid, processName); return 1; } snprintf(pid_string, PID_STRING_LEN, "%d\n", pid); write(pid_file_fd, pid_string, strlen(pid_string)); fsync(pid_file_fd); return 0; } int main(int argc, char *argv[]) { //Check if another process is running. int check_ret = checkProcessRunning(PROGRAM_NAME); if (check_ret != 0) { return check_ret; } //sleep(SHORTCAT_REG_DELAY); QApplication a(argc, argv); QFile qss(":/style/global"); QString locale = QLocale::system().name(); MainWindow w; w.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool); w.setWindowState(Qt::WindowActive); //w.setAttribute(Qt::WA_TranslucentBackground, false); //w.setWindowOpacity(0.5); return a.exec(); } ukui-window-switch/alt_tab_list.h0000664000175000017500000000255113223320605016072 0ustar fengfeng/* * Copyright (C) 2017 Tianjin KYLIN Information Technology Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef DBUS_CLIENT_H #define DBUS_CLIENT_H #undef signals #include #include #include #include #include bool InitUkwmPluginDBusComm(void); void FinishUkwmPluginDBusComm(void); bool UkwmPluginDBusServiceIsReady(void); GList *DBusGetAltTabList(void); void DBusActivateWindowByTabListIndex(int index); char *newstr(char *old_str); alt_tab_item *new_alt_tab_item(); void free_alt_tab_item(alt_tab_item *ati); //GFunc free_alt_tab_item_from_glist(gpointer data, gpointer user_data); #endif // DBUS_CLIENT_H