mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 04:17:33 +00:00
Merge pull request #173 from Francesco149/xinerama-support
Fix for Xinerama alignment bugs
This commit is contained in:
commit
c1dceef75a
@ -106,6 +106,7 @@ option(BUILD_X11 "Build X11 support" true)
|
|||||||
if(BUILD_X11)
|
if(BUILD_X11)
|
||||||
option(OWN_WINDOW "Enable own_window support" true)
|
option(OWN_WINDOW "Enable own_window support" true)
|
||||||
option(BUILD_XDAMAGE "Build Xdamage support" true)
|
option(BUILD_XDAMAGE "Build Xdamage support" true)
|
||||||
|
option(BUILD_XINERAMA "Build Xinerama support" true)
|
||||||
option(BUILD_XDBE "Build Xdbe (double-buffer) support" false)
|
option(BUILD_XDBE "Build Xdbe (double-buffer) support" false)
|
||||||
option(BUILD_XFT "Build Xft (freetype fonts) support" true)
|
option(BUILD_XFT "Build Xft (freetype fonts) support" true)
|
||||||
option(BUILD_IMLIB2 "Enable Imlib2 support" false)
|
option(BUILD_IMLIB2 "Enable Imlib2 support" false)
|
||||||
@ -113,6 +114,7 @@ if(BUILD_X11)
|
|||||||
else(BUILD_X11)
|
else(BUILD_X11)
|
||||||
set(OWN_WINDOW false CACHE BOOL "Enable own_window support" FORCE)
|
set(OWN_WINDOW false CACHE BOOL "Enable own_window support" FORCE)
|
||||||
set(BUILD_XDAMAGE false CACHE BOOL "Build Xdamage support" FORCE)
|
set(BUILD_XDAMAGE false CACHE BOOL "Build Xdamage support" FORCE)
|
||||||
|
set(BUILD_XINERAMA false CACHE BOOL "Build Xinerama support" FORCE)
|
||||||
set(BUILD_XDBE false CACHE BOOL "Build Xdbe (double-buffer) support" FORCE)
|
set(BUILD_XDBE false CACHE BOOL "Build Xdbe (double-buffer) support" FORCE)
|
||||||
set(BUILD_XFT false CACHE BOOL "Build Xft (freetype fonts) support" FORCE)
|
set(BUILD_XFT false CACHE BOOL "Build Xft (freetype fonts) support" FORCE)
|
||||||
set(BUILD_IMLIB2 false CACHE BOOL "Enable Imlib2 support" FORCE)
|
set(BUILD_IMLIB2 false CACHE BOOL "Enable Imlib2 support" FORCE)
|
||||||
|
45
cmake/FindXinerama.cmake
Normal file
45
cmake/FindXinerama.cmake
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# - Find the Xinerama include file and library
|
||||||
|
#
|
||||||
|
|
||||||
|
SET(Xinerama_INC_SEARCH_PATH
|
||||||
|
/usr/X11R6/include
|
||||||
|
/usr/local/include
|
||||||
|
/usr/include/X11
|
||||||
|
/usr/openwin/include
|
||||||
|
/usr/openwin/share/include
|
||||||
|
/opt/graphics/OpenGL/include
|
||||||
|
/usr/include)
|
||||||
|
|
||||||
|
SET(Xinerama_LIB_SEARCH_PATH
|
||||||
|
/usr/X11R6/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/openwin/lib
|
||||||
|
/usr/lib)
|
||||||
|
|
||||||
|
|
||||||
|
FIND_PATH(Xinerama_INCLUDE_DIR X11/extensions/Xinerama.h
|
||||||
|
${Xinerama_INC_SEARCH_PATH})
|
||||||
|
|
||||||
|
FIND_LIBRARY(Xinerama_LIBRARIES NAMES Xinerama PATH ${Xinerama_LIB_SEARCH_PATH})
|
||||||
|
|
||||||
|
IF (Xinerama_INCLUDE_DIR AND Xinerama_LIBRARIES)
|
||||||
|
SET(Xinerama_FOUND TRUE)
|
||||||
|
ENDIF (Xinerama_INCLUDE_DIR AND Xinerama_LIBRARIES)
|
||||||
|
|
||||||
|
IF (Xinerama_FOUND)
|
||||||
|
INCLUDE(CheckLibraryExists)
|
||||||
|
|
||||||
|
CHECK_LIBRARY_EXISTS(${Xinerama_LIBRARIES}
|
||||||
|
"XineramaQueryScreens"
|
||||||
|
${Xinerama_LIBRARIES}
|
||||||
|
Xinerama_HAS_QUERY)
|
||||||
|
|
||||||
|
IF (NOT Xinerama_HAS_QUERY AND Xinerama_FIND_REQUIRED)
|
||||||
|
MESSAGE(FATAL_ERROR "Could NOT find Xinerama")
|
||||||
|
ENDIF (NOT Xinerama_HAS_QUERY AND Xinerama_FIND_REQUIRED)
|
||||||
|
ENDIF (Xinerama_FOUND)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
Xinerama_INCLUDE_DIR
|
||||||
|
Xinerama_LIBRARIES
|
||||||
|
)
|
@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
#cmakedefine BUILD_XDAMAGE 1
|
#cmakedefine BUILD_XDAMAGE 1
|
||||||
|
|
||||||
|
#cmakedefine BUILD_XINERAMA 1
|
||||||
|
|
||||||
#cmakedefine BUILD_XFT 1
|
#cmakedefine BUILD_XFT 1
|
||||||
|
|
||||||
#cmakedefine BUILD_XSHAPE 1
|
#cmakedefine BUILD_XSHAPE 1
|
||||||
|
@ -207,7 +207,16 @@
|
|||||||
</term>
|
</term>
|
||||||
<listitem>Specify an X display to connect to.
|
<listitem>Specify an X display to connect to.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>
|
||||||
|
<option>xinerama_head</option>
|
||||||
|
</command>
|
||||||
|
</term>
|
||||||
|
<listitem>Specify a Xinerama head.
|
||||||
|
<para /></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>
|
<command>
|
||||||
|
@ -46,7 +46,8 @@ local num_setting = {
|
|||||||
maximum_width = true, mpd_port = true, music_player_interval = true, net_avg_samples = true,
|
maximum_width = true, mpd_port = true, music_player_interval = true, net_avg_samples = true,
|
||||||
own_window_argb_value = true, pad_percents = true, stippled_borders = true,
|
own_window_argb_value = true, pad_percents = true, stippled_borders = true,
|
||||||
text_buffer_size = true, top_name_width = true, total_run_times = true,
|
text_buffer_size = true, top_name_width = true, total_run_times = true,
|
||||||
update_interval = true, update_interval_on_battery = true, xftalpha = true
|
update_interval = true, update_interval_on_battery = true, xftalpha = true,
|
||||||
|
xinerama_head = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
local split_setting = {
|
local split_setting = {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
||||||
|
|
||||||
## Configuration items
|
## Configuration items
|
||||||
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|http_refresh|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
|
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|xinerama_head|http_refresh|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
|
||||||
|
|
||||||
## Configuration item constants
|
## Configuration item constants
|
||||||
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\>"
|
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\>"
|
||||||
|
@ -12,7 +12,7 @@ endif
|
|||||||
|
|
||||||
syn region ConkyrcComment start=/^\s*#/ end=/$/
|
syn region ConkyrcComment start=/^\s*#/ end=/$/
|
||||||
|
|
||||||
syn keyword ConkyrcSetting alignment append_file background border_inner_margin border_outer_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_height default_bar_width default_color default_gauge_height default_gauge_width default_graph_height default_graph_width default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades extra_newline font format_human_readable gap_x gap_y http_refresh if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_draw_hook_post lua_draw_hook_pre lua_load lua_shutdown_hook lua_startup_hook mail_spool max_port_monitor_connections max_text_width max_user_text maximum_width minimum_height minimum_width mpd_host mpd_password mpd_port music_player_interval mysql_host mysql_port mysql_user mysql_password mysql_db net_avg_samples no_buffers nvidia_display out_to_console out_to_http out_to_ncurses out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size times_in_seconds top_cpu_separate top_name_width total_run_times update_interval update_interval_on_battery uppercase use_spacer use_xft xftalpha xftfont
|
syn keyword ConkyrcSetting alignment append_file background border_inner_margin border_outer_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_height default_bar_width default_color default_gauge_height default_gauge_width default_graph_height default_graph_width default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades extra_newline font format_human_readable gap_x gap_y xinerama_head http_refresh if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_draw_hook_post lua_draw_hook_pre lua_load lua_shutdown_hook lua_startup_hook mail_spool max_port_monitor_connections max_text_width max_user_text maximum_width minimum_height minimum_width mpd_host mpd_password mpd_port music_player_interval mysql_host mysql_port mysql_user mysql_password mysql_db net_avg_samples no_buffers nvidia_display out_to_console out_to_http out_to_ncurses out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size times_in_seconds top_cpu_separate top_name_width total_run_times update_interval update_interval_on_battery uppercase use_spacer use_xft xftalpha xftfont
|
||||||
|
|
||||||
syn keyword ConkyrcConstant
|
syn keyword ConkyrcConstant
|
||||||
\ above
|
\ above
|
||||||
|
@ -127,6 +127,11 @@ endif(BUILD_PORT_MONITORS)
|
|||||||
if(BUILD_X11)
|
if(BUILD_X11)
|
||||||
set(x11 x11.cc fonts.cc)
|
set(x11 x11.cc fonts.cc)
|
||||||
set(optional_sources ${optional_sources} ${x11})
|
set(optional_sources ${optional_sources} ${x11})
|
||||||
|
|
||||||
|
if(BUILD_XINERAMA)
|
||||||
|
find_package(Xinerama REQUIRED)
|
||||||
|
set(conky_libs ${conky_libs} ${Xinerama_LIBRARIES})
|
||||||
|
endif(BUILD_XINERAMA)
|
||||||
endif(BUILD_X11)
|
endif(BUILD_X11)
|
||||||
|
|
||||||
if(BUILD_HDDTEMP)
|
if(BUILD_HDDTEMP)
|
||||||
|
38
src/x11.cc
38
src/x11.cc
@ -51,6 +51,9 @@
|
|||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#include <X11/extensions/shapeconst.h>
|
#include <X11/extensions/shapeconst.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BUILD_XINERAMA
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD_ARGB
|
#ifdef BUILD_ARGB
|
||||||
bool have_argb_visual;
|
bool have_argb_visual;
|
||||||
@ -310,6 +313,7 @@ namespace {
|
|||||||
|
|
||||||
conky::simple_config_setting<alignment> text_alignment("alignment", BOTTOM_LEFT, false);
|
conky::simple_config_setting<alignment> text_alignment("alignment", BOTTOM_LEFT, false);
|
||||||
conky::simple_config_setting<std::string> display_name("display", std::string(), false);
|
conky::simple_config_setting<std::string> display_name("display", std::string(), false);
|
||||||
|
static conky::simple_config_setting<int> head_index("xinerama_head", 0, true);
|
||||||
priv::out_to_x_setting out_to_x;
|
priv::out_to_x_setting out_to_x;
|
||||||
|
|
||||||
priv::colour_setting color[10] = {
|
priv::colour_setting color[10] = {
|
||||||
@ -449,6 +453,40 @@ static void update_workarea(void)
|
|||||||
workarea[1] = 0;
|
workarea[1] = 0;
|
||||||
workarea[2] = display_width;
|
workarea[2] = display_width;
|
||||||
workarea[3] = display_height;
|
workarea[3] = display_height;
|
||||||
|
|
||||||
|
#ifdef BUILD_XINERAMA
|
||||||
|
/* if xinerama is being used, adjust workarea to the head's area */
|
||||||
|
int useless1, useless2;
|
||||||
|
if (!XineramaQueryExtension(display, &useless1, &useless2)) {
|
||||||
|
return; /* doesn't even have xinerama */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!XineramaIsActive(display)) {
|
||||||
|
return; /* has xinerama but isn't using it */
|
||||||
|
}
|
||||||
|
|
||||||
|
int heads = 0;
|
||||||
|
XineramaScreenInfo *si = XineramaQueryScreens(display, &heads);
|
||||||
|
if (!si) {
|
||||||
|
NORM_ERR("warning: XineramaQueryScreen returned NULL, ignoring head settings");
|
||||||
|
return; /* queryscreens failed? */
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = head_index.get(*state);
|
||||||
|
if (i < 0 || i >= heads) {
|
||||||
|
NORM_ERR("warning: invalid head index, ignoring head settings");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
XineramaScreenInfo *ps = &si[i];
|
||||||
|
workarea[0] = ps->x_org;
|
||||||
|
workarea[1] = ps->y_org;
|
||||||
|
workarea[2] = workarea[0] + ps->width;
|
||||||
|
workarea[3] = workarea[1] + ps->height;
|
||||||
|
|
||||||
|
DBGP("Fixed xinerama area to: %d %d %d %d",
|
||||||
|
workarea[0], workarea[1], workarea[2], workarea[3]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find root window and desktop window.
|
/* Find root window and desktop window.
|
||||||
|
Loading…
Reference in New Issue
Block a user